-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
86 lines (83 loc) · 3.19 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// import core dependencies
import eslint from '@eslint/js';
// eslint-disable-next-line node/no-missing-import
import typescript from "typescript-eslint";
import globals from 'globals';
// import plugins
import formatting from "@stylistic/eslint-plugin";
import react from "eslint-plugin-react";
import hooks from "eslint-plugin-react-hooks";
import node from "eslint-plugin-node";
import html from "eslint-plugin-html";
import important from "eslint-plugin-import";
import security from "eslint-plugin-security";
// import modules
import coreDisableProblems from "./rules/core.disable.problems.js";
import coreOverrideProblems from "./rules/core.override.problems.js";
import coreOverrideSuggestions from "./rules/core.override.suggestions.js";
import coreOverrideFormatting from './rules/core.override.formatting.js';
import nodeDisableProblems from "./rules/node.disable.problems.js";
import nodeOverrideProblems from "./rules/node.override.problems.js";
import nodeOverrideSuggestions from "./rules/node.override.suggestions.js";
import typescriptOverrideStrict from './rules/typescript.override.strict.js';
// extends eslint recommended, stylistic recomended, typescript strictly typed, react recommended, security recommended and custom rules
export default typescript.config(eslint.configs.recommended, formatting.configs[`recommended-flat`], ...typescript.configs.strictTypeChecked, react.configs.flat.recommended, security.configs.recommended, {
name: `eslint-config-muleslint/recommended`,
// lint js as well as ts, exclude build files
files: [ `**/*.{js,jsx,ts,tsx}` ],
ignores: [ `**/build/**`, `**/dist/**` ],
languageOptions: {
...react.configs.flat.recommended.languageOptions,
ecmaVersion: `latest`,
sourceType: `module`,
// typescript parser for eslint + options
parser: typescript.parser,
parserOptions: {
// enable type-checked linting
projectService: true,
// general parser options
allowReserved: false,
ecmaFeatures: {
impliedStrict: true,
// why would someone do this ?
globalReturn: false,
jsx: true
}
},
// global variables for supported environments
globals: {
...globals.browser,
...globals.serviceworker,
...globals.nodeBuiltin
}
},
linterOptions: {
// disable ESLint inline comments
noInlineConfig: false
},
// declare as plugin for compatibility
plugins: {
[`react-hooks`]: hooks,
html,
important,
node
},
// custom rules
rules: {
// flat configs not supported ...
...hooks.configs.recommended.rules,
...coreDisableProblems,
...coreOverrideProblems,
...coreOverrideSuggestions,
...coreOverrideFormatting,
...nodeDisableProblems,
...nodeOverrideProblems,
...nodeOverrideSuggestions,
...typescriptOverrideStrict
}
}, {
// spread flat config for disabling type-checked linting
...typescript.configs.disableTypeChecked,
// apply for plain javascript files
files: [ `**/*.{js,jsx}` ]
});