@generatech/eslint-config-base 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +10 -0
- package/index.js +16 -0
- package/package.json +44 -0
- package/rules/best-practices.js +462 -0
- package/rules/errors.js +199 -0
- package/rules/es.js +218 -0
- package/rules/imports.js +301 -0
- package/rules/node.js +43 -0
- package/rules/style.js +653 -0
- package/rules/variables.js +67 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const confusingBrowserGlobals = require("confusing-browser-globals");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
rules: {
|
|
5
|
+
// enforce or disallow variable initializations at definition
|
|
6
|
+
"init-declarations": "off",
|
|
7
|
+
|
|
8
|
+
// disallow the catch clause parameter name being the same as a variable in the outer scope
|
|
9
|
+
"no-catch-shadow": "off",
|
|
10
|
+
|
|
11
|
+
// disallow deletion of variables
|
|
12
|
+
"no-delete-var": "error",
|
|
13
|
+
|
|
14
|
+
// disallow labels that share a name with a variable
|
|
15
|
+
// https://eslint.org/docs/rules/no-label-var
|
|
16
|
+
"no-label-var": "error",
|
|
17
|
+
|
|
18
|
+
// disallow specific globals
|
|
19
|
+
"no-restricted-globals": [
|
|
20
|
+
"error",
|
|
21
|
+
{
|
|
22
|
+
name: "isFinite",
|
|
23
|
+
message:
|
|
24
|
+
"Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "isNaN",
|
|
28
|
+
message:
|
|
29
|
+
"Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan",
|
|
30
|
+
},
|
|
31
|
+
].concat(
|
|
32
|
+
confusingBrowserGlobals.map((g) => ({
|
|
33
|
+
name: g,
|
|
34
|
+
message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
|
|
35
|
+
}))
|
|
36
|
+
),
|
|
37
|
+
|
|
38
|
+
// disallow declaration of variables already declared in the outer scope
|
|
39
|
+
"no-shadow": "error",
|
|
40
|
+
|
|
41
|
+
// disallow shadowing of names such as arguments
|
|
42
|
+
"no-shadow-restricted-names": "error",
|
|
43
|
+
|
|
44
|
+
// disallow use of undeclared variables unless mentioned in a /*global */ block
|
|
45
|
+
"no-undef": "error",
|
|
46
|
+
|
|
47
|
+
// disallow use of undefined when initializing variables
|
|
48
|
+
"no-undef-init": "error",
|
|
49
|
+
|
|
50
|
+
// disallow use of undefined variable
|
|
51
|
+
// https://eslint.org/docs/rules/no-undefined
|
|
52
|
+
// TODO: enable?
|
|
53
|
+
"no-undefined": "off",
|
|
54
|
+
|
|
55
|
+
// disallow declaration of variables that are not used in the code
|
|
56
|
+
"no-unused-vars": [
|
|
57
|
+
"error",
|
|
58
|
+
{ vars: "all", args: "after-used", ignoreRestSiblings: true },
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
// disallow use of variables before they are defined
|
|
62
|
+
"no-use-before-define": [
|
|
63
|
+
"error",
|
|
64
|
+
{ functions: true, classes: true, variables: true },
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
};
|