no env
@@ -1,22 +1,26 @@
1
module.exports = {
2
env: {
3
browser: true,
4
es2021: true
5
},
6
extends: "eslint:recommended",
7
parserOptions: {
8
ecmaVersion: 12,
9
sourceType: "module"
10
},
11
rules: {
12
"no-undef": "error", // Disallow the use of undeclared variables
13
"no-dupe-keys": "error", // Disallow duplicate keys in object literals
14
"curly": ["error", "all"], // Require curly braces for all control statements
15
"no-eval": "error", // Disallow the use of eval()
16
"no-multi-spaces": "error", // Disallow multiple spaces
17
"semi": ["error", "always"], // Require semicolons at the end of statements
18
"indent": ["error", "tab"], // Enforce consistent indentation with tabs
19
"prefer-const": "error", // Suggest using `const` if a variable is never reassigned
20
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"] // Disallow mixed spaces and tabs, allow smart-tabs
1
import { ESLint } from "eslint";
2
3
export default [
4
{
5
files: ["**/*.js"],
6
languageOptions: {
7
ecmaVersion: 12, // equivalent to es2021: true
8
sourceType: "module", // for ECMAScript modules
9
globals: {
10
window: "readonly", // For browser environment globals (e.g., `window`, `document`)
11
document: "readonly"
12
}
13
},
14
rules: {
15
"no-undef": "error", // Disallow the use of undeclared variables
16
"no-dupe-keys": "error", // Disallow duplicate keys in object literals
17
"curly": ["error", "all"], // Require curly braces for all control statements
18
"no-eval": "error", // Disallow the use of eval()
19
"no-multi-spaces": "error", // Disallow multiple spaces
20
"semi": ["error", "always"], // Require semicolons at the end of statements
21
"indent": ["error", "tab"], // Enforce consistent indentation with tabs
22
"prefer-const": "error", // Suggest using `const` if a variable is never reassigned
23
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"] // Disallow mixed spaces and tabs, allow smart-tabs
24
}
21
25
}
22
};
26
];
@@ -1,22 +1,26 @@1
module.exports = {1
import { ESLint } from "eslint";2
env: {2
3
browser: true,3
export default [4
es2021: true4
{5
},5
files: ["**/*.js"],6
extends: "eslint:recommended",6
languageOptions: {7
parserOptions: {7
ecmaVersion: 12, // equivalent to es2021: true8
ecmaVersion: 12,8
sourceType: "module", // for ECMAScript modules9
sourceType: "module"9
globals: {10
},10
window: "readonly", // For browser environment globals (e.g., `window`, `document`)11
rules: {11
document: "readonly"12
"no-undef": "error", // Disallow the use of undeclared variables12
}13
"no-dupe-keys": "error", // Disallow duplicate keys in object literals13
},14
"curly": ["error", "all"], // Require curly braces for all control statements14
rules: {15
"no-eval": "error", // Disallow the use of eval()15
"no-undef": "error", // Disallow the use of undeclared variables16
"no-multi-spaces": "error", // Disallow multiple spaces16
"no-dupe-keys": "error", // Disallow duplicate keys in object literals17
"semi": ["error", "always"], // Require semicolons at the end of statements17
"curly": ["error", "all"], // Require curly braces for all control statements18
"indent": ["error", "tab"], // Enforce consistent indentation with tabs18
"no-eval": "error", // Disallow the use of eval()19
"prefer-const": "error", // Suggest using `const` if a variable is never reassigned19
"no-multi-spaces": "error", // Disallow multiple spaces20
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"] // Disallow mixed spaces and tabs, allow smart-tabs20
"semi": ["error", "always"], // Require semicolons at the end of statements21
"indent": ["error", "tab"], // Enforce consistent indentation with tabs22
"prefer-const": "error", // Suggest using `const` if a variable is never reassigned23
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"] // Disallow mixed spaces and tabs, allow smart-tabs24
}21
}25
}22
};26
];