-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.cjs
116 lines (113 loc) · 3.91 KB
/
.eslintrc.cjs
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
module.exports = {
root: true,
// Specify the environments where your code will run
env: {
browser: true,
es2023: true,
},
// Extend configurations from various ESLint plugins
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
"plugin:import/recommended",
"plugin:jsonc/base", // or use jsonc/recommended-with-(json/jsonc/json5/prettier )
"plugin:security/recommended",
"plugin:unicorn/recommended",
"plugin:sonarjs/recommended",
"plugin:compat/recommended", // see browse list in package.json
"prettier", // Make sure this is the last,
],
plugins: ["html", "import", "simple-import-sort", "unicorn", "sonarjs", "react-refresh", "jsx-a11y"],
// Configure settings for certain plugins
settings: {
"import/docstyle": ["jsdoc", "tomdoc"],
// compat plugin : polyfills web api
polyfills: [
// Example of marking entire API and all methods and properties as polyfilled
"Promise",
// Example of marking specific method of an API as polyfilled
"WebAssembly.compile",
// Example of API with no property (i.e. a function)
"fetch",
// Example of instance method, must add `.prototype.`
"Array.prototype.push",
],
react: { version: "18.2" },
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".json", ".vue", ".ts", ".tsx", ".d.ts"],
},
alias: {
extensions: [".js", ".jsx", ".json", ".ts", ".tsx", ".d.ts"],
map: [
["@", "./src"],
["@assets", "./src/assets"],
["@images", "./src/assets/images"],
["@svg", "./src/assets/svg"],
["@videos", "./src/assets/videos"],
["@scss", "./src/scss"],
["@abstracts", "./src/scss/abstracts"],
["@base", "./src/scss/base"],
["@scssComponents", "./src/scss/scssComponents"],
["@utilities", "./src/scss/utilities"],
["@jsx", "./src/jsx"],
["@components", "./src/jsx/components"],
["@contexts", "./src/jsx/contexts"],
["@data", "./src/jsx/data"],
["@utils", "./src/jsx/utils"],
["@pages", "./src/jsx/pages"],
["@routes", "./src/jsx/routes"],
["@images", "./src/assets/images"],
["@svg", "./src/assets/svg"],
],
},
},
},
overrides: [
{
files: [".eslintrc.{js,cjs}"],
env: {
node: true,
},
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
ignorePatterns: ["**/node_modules/", "**/build/", "**/dist/", "**/.vscode/", "**/.idea/", "**/.git/", "**/coverage/", "**/.cache/", "**/__tests__/", "**/*.config.cjs", "**/*.config.mjs", "**/*.config.js", "**/*.config.ts", "**/*.test.js", "**/*.test.ts", "**/*.spec.js", "**/*.spec.ts"],
rules: {
// get ride of import/no-unresolved when using ?react for svgr (svg as component)
// 'import/no-unresolved': ['error', { ignore: ['\\.svg\\?react$'] }],
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"react/prop-types": ["warn"],
// Organize imports using simple-import-sort
"simple-import-sort/imports": "off",
"simple-import-sort/exports": "error",
"no-unused-vars": ["warn", { vars: "all", args: "after-used", ignoreRestSiblings: false }],
// Ensure imports are at the beginning of the file
"import/first": "error",
// Require a newline after import statements
"import/newline-after-import": "error",
// Prevent duplicate imports
"import/no-duplicates": "error",
// Allow empty named blocks in imports (with a warning)
"import/no-empty-named-blocks": "warn",
"sonarjs/no-duplicate-string": "warn",
"sonarjs/cognitive-complexity": "warn",
// Disable some unicorn plugin rules
"unicorn/consistent-function-scoping": "warn",
"unicorn/numeric-separators-style": "warn",
"unicorn/prevent-abbreviations": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-array-for-each": "off",
"unicorn/filename-case": ["off"],
"unicorn/no-null": "off",
},
};