@asd14/eslint-config 10.3.0 → 12.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/LICENSE +1 -1
- package/README.md +24 -177
- package/dist/types/eslint.config.d.ts +212 -0
- package/dist/types/src/configs/node-jest.d.ts +17 -0
- package/dist/types/src/configs/node.d.ts +210 -0
- package/dist/types/src/configs/nx.d.ts +66 -0
- package/dist/types/src/configs/react-jest.d.ts +20 -0
- package/dist/types/src/configs/react.d.ts +1481 -0
- package/dist/types/src/configs/ts-node.d.ts +252 -0
- package/dist/types/src/index.d.ts +6 -0
- package/dist/types/src/rules/base.d.ts +16 -0
- package/dist/types/src/rules/import.d.ts +44 -0
- package/dist/types/src/rules/jsdoc.d.ts +40 -0
- package/dist/types/src/rules/react.d.ts +120 -0
- package/dist/types/src/rules/rtl.d.ts +13 -0
- package/dist/types/src/rules/typescript.d.ts +53 -0
- package/dist/types/src/rules/unicorn.d.ts +42 -0
- package/dist/types/src/utils/find-up-sync.d.ts +34 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +52 -65
- package/src/configs/node-jest.js +29 -0
- package/src/configs/node.js +65 -0
- package/src/configs/nx.js +121 -0
- package/src/configs/react-jest.js +16 -0
- package/src/configs/react.js +86 -0
- package/src/configs/ts-node.js +23 -0
- package/src/index.js +6 -0
- package/src/rules/base.js +24 -0
- package/src/rules/import.js +55 -0
- package/src/rules/jsdoc.js +49 -0
- package/{rules → src/rules}/react.js +41 -27
- package/src/rules/rtl.js +6 -0
- package/src/rules/typescript.js +88 -0
- package/{rules → src/rules}/unicorn.js +19 -41
- package/src/utils/find-up-sync.js +56 -0
- package/rules/best-practices.js +0 -11
- package/rules/comments.js +0 -46
- package/rules/errors.js +0 -112
- package/rules/es6.js +0 -48
- package/rules/html.js +0 -59
- package/rules/import-ts.js +0 -41
- package/rules/import.js +0 -101
- package/rules/jsdoc-ts.js +0 -8
- package/rules/jsdoc.js +0 -103
- package/rules/json.js +0 -9
- package/rules/node.js +0 -56
- package/rules/prettier.js +0 -16
- package/rules/promise.js +0 -68
- package/rules/style.js +0 -252
- package/rules/variables.js +0 -70
- package/targets/node-esm.js +0 -25
- package/targets/node-ts.js +0 -36
- package/targets/node.js +0 -36
- package/targets/react-ts.js +0 -94
- package/targets/react.js +0 -90
package/rules/errors.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
rules: {
|
|
3
|
-
/*
|
|
4
|
-
* A for loop with a stop condition that can never be reached, such as
|
|
5
|
-
* one with a counter that moves in the wrong direction, will run
|
|
6
|
-
* infinitely. While there are occasions when an infinite loop is
|
|
7
|
-
* intended, the convention is to construct such loops as while loops.
|
|
8
|
-
* More typically, an infinite for loop is a bug.
|
|
9
|
-
*/
|
|
10
|
-
"for-direction": "error",
|
|
11
|
-
|
|
12
|
-
// Disallow assignment in conditional expressions
|
|
13
|
-
"no-cond-assign": ["error", "always"],
|
|
14
|
-
|
|
15
|
-
// Disallow use of console
|
|
16
|
-
"no-console": 1,
|
|
17
|
-
|
|
18
|
-
// Disallow use of constant expressions in conditions
|
|
19
|
-
"no-constant-condition": 1,
|
|
20
|
-
|
|
21
|
-
// Disallow control characters in regular expressions
|
|
22
|
-
"no-control-regex": "error",
|
|
23
|
-
|
|
24
|
-
// Disallow use of debugger
|
|
25
|
-
"no-debugger": 1,
|
|
26
|
-
|
|
27
|
-
// Disallow duplicate arguments in functions
|
|
28
|
-
"no-dupe-args": "error",
|
|
29
|
-
|
|
30
|
-
// Disallow duplicate keys when creating object literals
|
|
31
|
-
"no-dupe-keys": "error",
|
|
32
|
-
|
|
33
|
-
// Disallow a duplicate case label.
|
|
34
|
-
"no-duplicate-case": "error",
|
|
35
|
-
|
|
36
|
-
// Disallow empty statements
|
|
37
|
-
"no-empty": "error",
|
|
38
|
-
|
|
39
|
-
// Disallow the use of empty character classes in regular expressions
|
|
40
|
-
"no-empty-character-class": "error",
|
|
41
|
-
|
|
42
|
-
// Disallow assigning to the exception in a catch block
|
|
43
|
-
"no-ex-assign": "error",
|
|
44
|
-
|
|
45
|
-
// Disallow double-negation boolean casts in a boolean context
|
|
46
|
-
"no-extra-boolean-cast": 0,
|
|
47
|
-
|
|
48
|
-
// Disallow overwriting functions written as function declarations
|
|
49
|
-
"no-func-assign": "error",
|
|
50
|
-
|
|
51
|
-
// Disallow function or variable declarations in nested blocks
|
|
52
|
-
"no-inner-declarations": "error",
|
|
53
|
-
|
|
54
|
-
/*
|
|
55
|
-
* Disallow invalid regular expression strings in the RegExp
|
|
56
|
-
* Constructor
|
|
57
|
-
*/
|
|
58
|
-
"no-invalid-regexp": "error",
|
|
59
|
-
|
|
60
|
-
// Disallow irregular whitespace outside of strings and comments
|
|
61
|
-
"no-irregular-whitespace": "error",
|
|
62
|
-
|
|
63
|
-
// Disallow negation of the left operand of an in expression
|
|
64
|
-
"no-negated-in-lhs": "error",
|
|
65
|
-
|
|
66
|
-
/*
|
|
67
|
-
* Disallow the use of object properties of the global object (Math
|
|
68
|
-
* And JSON) as functions
|
|
69
|
-
*/
|
|
70
|
-
"no-obj-calls": "error",
|
|
71
|
-
|
|
72
|
-
// Disallow multiple spaces in a regular expression literal
|
|
73
|
-
"no-regex-spaces": "error",
|
|
74
|
-
|
|
75
|
-
/*
|
|
76
|
-
* This rule disallows sparse array literals which have "holes" where
|
|
77
|
-
* Commas are not preceded by elements. It does not apply to a
|
|
78
|
-
* Trailing comma following the last element.
|
|
79
|
-
*/
|
|
80
|
-
"no-sparse-arrays": "error",
|
|
81
|
-
|
|
82
|
-
/*
|
|
83
|
-
* Disallow unreachable statements after a return, throw, continue, or
|
|
84
|
-
* Break statement
|
|
85
|
-
*/
|
|
86
|
-
"no-unreachable": "error",
|
|
87
|
-
|
|
88
|
-
// Disallow comparisons with the value NaN
|
|
89
|
-
"use-isnan": "error",
|
|
90
|
-
|
|
91
|
-
/*
|
|
92
|
-
* Ensure that the results of typeof are compared against a valid
|
|
93
|
-
* String
|
|
94
|
-
*/
|
|
95
|
-
"valid-typeof": "error",
|
|
96
|
-
|
|
97
|
-
// Enforces that a return statement is present in property getters
|
|
98
|
-
"getter-return": "error",
|
|
99
|
-
|
|
100
|
-
/*
|
|
101
|
-
* The parseInt() and Number.parseInt() functions can be used to turn
|
|
102
|
-
* binary, octal, and hexadecimal strings into integers. As binary,
|
|
103
|
-
* octal, and hexadecimal literals are supported in ES6, this rule
|
|
104
|
-
* encourages use of those numeric literals instead of parseInt() or
|
|
105
|
-
* Number.parseInt().
|
|
106
|
-
*
|
|
107
|
-
* 0b111110111 === 503; // not parseInt("111110111", 2) === 503;
|
|
108
|
-
* 0o767 === 503; // not parseInt("767", 8) === 503;
|
|
109
|
-
*/
|
|
110
|
-
"prefer-numeric-literals": "error",
|
|
111
|
-
},
|
|
112
|
-
}
|
package/rules/es6.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
rules: {
|
|
3
|
-
// Require braces in arrow function body
|
|
4
|
-
"arrow-body-style": ["error", "as-needed"],
|
|
5
|
-
|
|
6
|
-
// Verify super() callings in constructors
|
|
7
|
-
"constructor-super": 0,
|
|
8
|
-
|
|
9
|
-
// Disallow modifying variables of class declarations
|
|
10
|
-
"no-class-assign": 0,
|
|
11
|
-
|
|
12
|
-
// Disallow modifying variables that are declared using const
|
|
13
|
-
"no-const-assign": "error",
|
|
14
|
-
|
|
15
|
-
// Disallow duplicate name in class members
|
|
16
|
-
"no-dupe-class-members": 0,
|
|
17
|
-
|
|
18
|
-
// Disallow to use this/super before super() calling in constructors.
|
|
19
|
-
"no-this-before-super": 0,
|
|
20
|
-
|
|
21
|
-
// Require let or const instead of var
|
|
22
|
-
"no-var": "error",
|
|
23
|
-
|
|
24
|
-
// Require method and property shorthand syntax for object literals
|
|
25
|
-
"object-shorthand": ["warn", "always"],
|
|
26
|
-
|
|
27
|
-
// Suggest using arrow functions as callbacks
|
|
28
|
-
"prefer-arrow-callback": "warn",
|
|
29
|
-
|
|
30
|
-
/*
|
|
31
|
-
* Suggest using of const declaration for variables that are never
|
|
32
|
-
* Modified after declared
|
|
33
|
-
*/
|
|
34
|
-
"prefer-const": "error",
|
|
35
|
-
|
|
36
|
-
// Suggest using Reflect methods where applicable
|
|
37
|
-
"prefer-reflect": 0,
|
|
38
|
-
|
|
39
|
-
// Suggest using the spread operator instead of .apply()
|
|
40
|
-
"prefer-spread": 0,
|
|
41
|
-
|
|
42
|
-
// Suggest using template literals instead of strings concatenation
|
|
43
|
-
"prefer-template": "error",
|
|
44
|
-
|
|
45
|
-
// Disallow generator functions that do not have yield
|
|
46
|
-
"require-yield": 0,
|
|
47
|
-
},
|
|
48
|
-
}
|
package/rules/html.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: ["html"],
|
|
3
|
-
settings: {
|
|
4
|
-
/*
|
|
5
|
-
* By default, this plugin will only consider files ending with those
|
|
6
|
-
* extensions as HTML: .erb, .handlebars, .hbs, .htm, .html,
|
|
7
|
-
* .mustache, .nunjucks, .php, .tag, .twig, .vue, .we. You can set
|
|
8
|
-
* your own list of HTML extensions by using this setting. Example:
|
|
9
|
-
*/
|
|
10
|
-
"html/html-extensions": [
|
|
11
|
-
".erb",
|
|
12
|
-
".handlebars",
|
|
13
|
-
".hbs",
|
|
14
|
-
".htm",
|
|
15
|
-
".html",
|
|
16
|
-
".mustache",
|
|
17
|
-
".nunjucks",
|
|
18
|
-
".php",
|
|
19
|
-
".tag",
|
|
20
|
-
".twig",
|
|
21
|
-
".vue",
|
|
22
|
-
".we",
|
|
23
|
-
],
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
* By default, this plugin will only consider files ending with those
|
|
27
|
-
* extensions as XML: .xhtml, .xml. You can set your own list of XML
|
|
28
|
-
* extensions by using this setting. Example:
|
|
29
|
-
*/
|
|
30
|
-
"html/xml-extensions": [".xhtml", ".xml"],
|
|
31
|
-
|
|
32
|
-
/*
|
|
33
|
-
* Indentation is the <script> indentation plus two spaces.
|
|
34
|
-
*/
|
|
35
|
-
"html/indent": "+0",
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
* By default, this plugin won't warn if it encounters a problematic
|
|
39
|
-
* indentation (ex: a line is under indented). If you want to make
|
|
40
|
-
* sure the indentation is correct, use the html/report-bad-indent in
|
|
41
|
-
* conjunction with the indent rule. Pass "warn" or 1 to display
|
|
42
|
-
* warnings, "error" or 2 to display errors. Example:
|
|
43
|
-
*/
|
|
44
|
-
"html/report-bad-indent": "error",
|
|
45
|
-
|
|
46
|
-
/*
|
|
47
|
-
* By default, the code between <script> tags is considered as
|
|
48
|
-
* JavaScript code only if there is no type attribute or if its value
|
|
49
|
-
* matches the pattern:
|
|
50
|
-
* /^(application|text)\/(x-)?(javascript|babel|ecmascript-6)$/i
|
|
51
|
-
*
|
|
52
|
-
* You can customize the types that should be considered as JavaScript
|
|
53
|
-
* by providing one or multiple MIME types. If a MIME type starts with
|
|
54
|
-
* a /, it will be considered as a regular expression.
|
|
55
|
-
*/
|
|
56
|
-
"html/javascript-mime-types":
|
|
57
|
-
"/^(application|text)/(x-)?(javascript|babel|ecmascript-6)$/i",
|
|
58
|
-
},
|
|
59
|
-
}
|
package/rules/import-ts.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: ["plugin:import/typescript"],
|
|
3
|
-
|
|
4
|
-
rules: {
|
|
5
|
-
/*
|
|
6
|
-
* TypeScript compilation already ensures that named imports exist in the
|
|
7
|
-
* referenced module
|
|
8
|
-
*/
|
|
9
|
-
"import/named": "off",
|
|
10
|
-
|
|
11
|
-
// Typescript handles file resolving
|
|
12
|
-
"import/no-unresolved": "off",
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
* A list of file extensions that will be parsed as modules and
|
|
16
|
-
* inspected for exports.
|
|
17
|
-
*/
|
|
18
|
-
"import/extensions": [
|
|
19
|
-
"error",
|
|
20
|
-
"always",
|
|
21
|
-
{
|
|
22
|
-
js: "always",
|
|
23
|
-
ts: "never",
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
settings: {
|
|
29
|
-
"import/external-module-folders": ["node_modules", "node_modules/@types"],
|
|
30
|
-
|
|
31
|
-
"import/parsers": {
|
|
32
|
-
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"],
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
"import/resolver": {
|
|
36
|
-
node: {
|
|
37
|
-
extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx"],
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
}
|
package/rules/import.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: ["import", "no-relative-import-paths"],
|
|
3
|
-
extends: ["plugin:import/recommended"],
|
|
4
|
-
rules: {
|
|
5
|
-
"no-relative-import-paths/no-relative-import-paths": "off",
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Sort alphabetically, and enforce that all imports are at the top
|
|
9
|
-
* of the file.
|
|
10
|
-
*/
|
|
11
|
-
"import/order": [
|
|
12
|
-
"error",
|
|
13
|
-
{
|
|
14
|
-
"newlines-between": "always",
|
|
15
|
-
"alphabetize": {
|
|
16
|
-
order: "asc",
|
|
17
|
-
caseInsensitive: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
* If a default import is requested, this rule will report if there is
|
|
24
|
-
* no default export in the imported module.
|
|
25
|
-
*/
|
|
26
|
-
"import/default": "error",
|
|
27
|
-
|
|
28
|
-
/*
|
|
29
|
-
* Reports funny business with exports, like repeated exports of names
|
|
30
|
-
* or defaults.
|
|
31
|
-
*/
|
|
32
|
-
"import/export": "error",
|
|
33
|
-
|
|
34
|
-
/*
|
|
35
|
-
* Verifies that all named imports are part of the set of named
|
|
36
|
-
* exports in the referenced module.
|
|
37
|
-
*/
|
|
38
|
-
"import/named": "error",
|
|
39
|
-
|
|
40
|
-
/*
|
|
41
|
-
* Enforces names exist at the time they are dereferenced, when
|
|
42
|
-
* imported as a full namespace (i.e. import * as foo from './foo';
|
|
43
|
-
* foo.bar(); will report if bar is not exported by ./foo.).
|
|
44
|
-
*/
|
|
45
|
-
"import/namespace": [
|
|
46
|
-
"error",
|
|
47
|
-
{
|
|
48
|
-
allowComputed: true,
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
|
|
52
|
-
// Reports if a resolved path is imported more than once.
|
|
53
|
-
"import/no-duplicates": "error",
|
|
54
|
-
|
|
55
|
-
/*
|
|
56
|
-
* Reports use of an exported name as the locally imported name of a
|
|
57
|
-
* default export.
|
|
58
|
-
*/
|
|
59
|
-
"import/no-named-as-default": "error",
|
|
60
|
-
|
|
61
|
-
// Reports use of an exported name as a property on the default export.
|
|
62
|
-
"import/no-named-as-default-member": "error",
|
|
63
|
-
|
|
64
|
-
/*
|
|
65
|
-
* Ensures an imported module can be resolved to a module on the local
|
|
66
|
-
* filesystem, as defined by standard Node require.resolve behavior.
|
|
67
|
-
*/
|
|
68
|
-
"import/no-unresolved": [
|
|
69
|
-
"error",
|
|
70
|
-
{
|
|
71
|
-
commonjs: true,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
|
|
75
|
-
/*
|
|
76
|
-
* Warn if a module could be mistakenly parsed as a script by a
|
|
77
|
-
* consumer leveraging Unambiguous JavaScript Grammar to determine
|
|
78
|
-
* correct parsing goal.
|
|
79
|
-
*/
|
|
80
|
-
"import/unambiguous": "off",
|
|
81
|
-
|
|
82
|
-
/*
|
|
83
|
-
* A list of file extensions that will be parsed as modules and
|
|
84
|
-
* inspected for exports.
|
|
85
|
-
*/
|
|
86
|
-
"import/extensions": [
|
|
87
|
-
"error",
|
|
88
|
-
"always",
|
|
89
|
-
{
|
|
90
|
-
js: "always",
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
|
|
94
|
-
/*
|
|
95
|
-
* Enforces that all exports are declared at the bottom of the file.
|
|
96
|
-
* This rule will report any export declarations that comes before any
|
|
97
|
-
* non-export statements.
|
|
98
|
-
*/
|
|
99
|
-
"import/exports-last": "error",
|
|
100
|
-
},
|
|
101
|
-
}
|
package/rules/jsdoc-ts.js
DELETED
package/rules/jsdoc.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* JSDoc is a JavaScript API documentation generator. It uses
|
|
3
|
-
* specially-formatted comments inside of code to generate API
|
|
4
|
-
* documentation automatically.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
plugins: ["jsdoc"],
|
|
9
|
-
|
|
10
|
-
extends: ["plugin:eslint-plugin-jsdoc/recommended"],
|
|
11
|
-
|
|
12
|
-
rules: {
|
|
13
|
-
"require-jsdoc": [
|
|
14
|
-
"error",
|
|
15
|
-
{
|
|
16
|
-
require: {
|
|
17
|
-
ArrowFunctionExpression: false,
|
|
18
|
-
ClassDeclaration: false,
|
|
19
|
-
FunctionDeclaration: true,
|
|
20
|
-
MethodDefinition: false,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
|
|
25
|
-
"valid-jsdoc": [
|
|
26
|
-
"error",
|
|
27
|
-
{
|
|
28
|
-
requireParamType: false,
|
|
29
|
-
requireParamDescription: false,
|
|
30
|
-
requireReturnType: false,
|
|
31
|
-
requireReturnDescription: false,
|
|
32
|
-
|
|
33
|
-
prefer: {
|
|
34
|
-
arg: "param",
|
|
35
|
-
argument: "param",
|
|
36
|
-
class: "constructor",
|
|
37
|
-
return: "returns",
|
|
38
|
-
virtual: "abstract",
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
preferType: {
|
|
42
|
-
Boolean: "boolean",
|
|
43
|
-
Number: "number",
|
|
44
|
-
object: "object",
|
|
45
|
-
String: "string",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
|
|
50
|
-
// Allow lines between tags
|
|
51
|
-
"jsdoc/tag-lines": "off",
|
|
52
|
-
|
|
53
|
-
"jsdoc/check-tag-names": [
|
|
54
|
-
"warn",
|
|
55
|
-
{
|
|
56
|
-
definedTags: [
|
|
57
|
-
"tag",
|
|
58
|
-
"signature",
|
|
59
|
-
"api",
|
|
60
|
-
"apiDefine",
|
|
61
|
-
"apiDeprecated",
|
|
62
|
-
"apiDescription",
|
|
63
|
-
"apiError",
|
|
64
|
-
"apiErrorExample",
|
|
65
|
-
"apiExample",
|
|
66
|
-
"apiGroup",
|
|
67
|
-
"apiHeader",
|
|
68
|
-
"apiHeaderExample",
|
|
69
|
-
"apiIgnore",
|
|
70
|
-
"apiName",
|
|
71
|
-
"apiParam",
|
|
72
|
-
"apiParamExample",
|
|
73
|
-
"apiPermission",
|
|
74
|
-
"apiPrivate",
|
|
75
|
-
"apiSampleRequest",
|
|
76
|
-
"apiSuccess",
|
|
77
|
-
"apiSuccessExample",
|
|
78
|
-
"apiUse",
|
|
79
|
-
"apiVersion",
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
|
|
84
|
-
// Noise
|
|
85
|
-
"jsdoc/require-param-description": "off",
|
|
86
|
-
"jsdoc/require-returns-description": "off",
|
|
87
|
-
"jsdoc/require-property-description": "off",
|
|
88
|
-
"jsdoc/check-types": "off",
|
|
89
|
-
|
|
90
|
-
"jsdoc/check-indentation": [
|
|
91
|
-
"error",
|
|
92
|
-
{ excludeTags: ["example", "param", "returns", "type", "typedef"] },
|
|
93
|
-
],
|
|
94
|
-
|
|
95
|
-
"jsdoc/check-line-alignment": [
|
|
96
|
-
"error",
|
|
97
|
-
"always",
|
|
98
|
-
{
|
|
99
|
-
tags: ["param", "arg", "argument", "property", "prop"],
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
}
|
package/rules/json.js
DELETED
package/rules/node.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
rules: {
|
|
3
|
-
// Enforce return after a callback
|
|
4
|
-
"callback-return": 0,
|
|
5
|
-
|
|
6
|
-
// Disallow require() outside of the top-level module scope
|
|
7
|
-
"global-require": 0,
|
|
8
|
-
|
|
9
|
-
// Enforces error handling in callbacks (node environment)
|
|
10
|
-
"handle-callback-err": 0,
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* In Node.js, the behavior of the Buffer constructor is different
|
|
14
|
-
* depending on the type of its argument. Passing an argument from
|
|
15
|
-
* user input to Buffer() without validating its type can lead to
|
|
16
|
-
* security vulnerabilities such as remote memory disclosure and
|
|
17
|
-
* denial of service. As a result, the Buffer constructor has been
|
|
18
|
-
* deprecated and should not be used. Use the producer methods
|
|
19
|
-
* Buffer.from, Buffer.alloc, and Buffer.allocUnsafe instead.
|
|
20
|
-
*/
|
|
21
|
-
"no-buffer-constructor": "error",
|
|
22
|
-
|
|
23
|
-
// Disallow mixing regular variable and require declarations
|
|
24
|
-
"no-mixed-requires": [0, false],
|
|
25
|
-
|
|
26
|
-
// Disallow use of new operator with the require function
|
|
27
|
-
"no-new-require": 0,
|
|
28
|
-
|
|
29
|
-
// Disallow string concatenation with __dirname and __filename
|
|
30
|
-
"no-path-concat": 0,
|
|
31
|
-
|
|
32
|
-
// Disallow process.exit()
|
|
33
|
-
"no-process-exit": 0,
|
|
34
|
-
|
|
35
|
-
// Restrict usage of specified node modules
|
|
36
|
-
"no-restricted-modules": 0,
|
|
37
|
-
|
|
38
|
-
/*
|
|
39
|
-
* In Node.js, most I/O is done through asynchronous methods. However,
|
|
40
|
-
* there are often synchronous versions of the asynchronous methods.
|
|
41
|
-
* For example, fs.exists() and fs.existsSync(). In some contexts,
|
|
42
|
-
* using synchronous operations is okay (if, as with ESLint, you are
|
|
43
|
-
* writing a command line utility). However, in other contexts the use
|
|
44
|
-
* of synchronous operations is considered a bad practice that should
|
|
45
|
-
* be avoided. For example, if you are running a high-travel web
|
|
46
|
-
* server on Node.js, you should consider carefully if you want to
|
|
47
|
-
* allow any synchronous operations that could lock up the server.
|
|
48
|
-
*/
|
|
49
|
-
"no-sync": [
|
|
50
|
-
"error",
|
|
51
|
-
{
|
|
52
|
-
allowAtRootLevel: true,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
}
|
package/rules/prettier.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: ["plugin:prettier/recommended"],
|
|
3
|
-
|
|
4
|
-
rules: {
|
|
5
|
-
/**
|
|
6
|
-
* If a block (for example after if, else, for or while) contains only one
|
|
7
|
-
* statement, JavaScript allows omitting the curly braces around that
|
|
8
|
-
* statement. This rule enforces if or when those optional curly
|
|
9
|
-
* braces should be omitted.
|
|
10
|
-
*
|
|
11
|
-
* ! Needs to be Prettier compatible:
|
|
12
|
-
* https://github.com/prettier/eslint-config-prettier#curly
|
|
13
|
-
*/
|
|
14
|
-
curly: ["error", "all"],
|
|
15
|
-
},
|
|
16
|
-
}
|
package/rules/promise.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: ["promise"],
|
|
3
|
-
|
|
4
|
-
rules: {
|
|
5
|
-
/*
|
|
6
|
-
* Ensure that each time a then() is applied to a promise, a catch()
|
|
7
|
-
* is applied as well. Exceptions are made if you are returning that
|
|
8
|
-
* promise.
|
|
9
|
-
*/
|
|
10
|
-
"promise/catch-or-return": "warn",
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Ensure that inside a then() you make sure to return a new promise
|
|
14
|
-
* or value.
|
|
15
|
-
*
|
|
16
|
-
* http://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html
|
|
17
|
-
* (rule #5) for more info on why that's a good idea.
|
|
18
|
-
*
|
|
19
|
-
* We also allow someone to throw inside a then() which is essentially
|
|
20
|
-
* the same as return Promise.reject().
|
|
21
|
-
*/
|
|
22
|
-
"promise/always-return": "off",
|
|
23
|
-
|
|
24
|
-
/*
|
|
25
|
-
* Ensure that inside a then() or a catch() we always return or throw
|
|
26
|
-
* a raw value instead of wrapping in Promise.resolve or Promise.reject
|
|
27
|
-
*/
|
|
28
|
-
"promise/no-return-wrap": ["error", { allowReject: false }],
|
|
29
|
-
|
|
30
|
-
// Enforce standard parameter names for Promise constructors
|
|
31
|
-
"promise/param-names": "error",
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* Ensure that Promise is included fresh in each file instead of
|
|
35
|
-
* relying on the existence of a native promise implementation.
|
|
36
|
-
* Helpful if you want to use bluebird or if you don't intend to use
|
|
37
|
-
* an ES6 Promise shim.
|
|
38
|
-
*/
|
|
39
|
-
"promise/no-native": "off",
|
|
40
|
-
|
|
41
|
-
// Avoid nested .then() or .catch() statements
|
|
42
|
-
"promise/no-nesting": "warn",
|
|
43
|
-
|
|
44
|
-
// Avoid using promises inside of callbacks
|
|
45
|
-
"promise/no-promise-in-callback": "warn",
|
|
46
|
-
|
|
47
|
-
// Avoid calling cb() inside of a then() (use nodeify] instead)
|
|
48
|
-
"promise/no-callback-in-promise": "warn",
|
|
49
|
-
|
|
50
|
-
/*
|
|
51
|
-
* Avoid creating new promises outside of utility libs (use pify
|
|
52
|
-
* instead)
|
|
53
|
-
*/
|
|
54
|
-
"promise/avoid-new": "warn",
|
|
55
|
-
|
|
56
|
-
// Prefer await to then() for reading Promise values
|
|
57
|
-
"promise/prefer-await-to-then": "off",
|
|
58
|
-
|
|
59
|
-
// Prefer async/await to the callback pattern
|
|
60
|
-
"promise/prefer-await-to-callbacks": "off",
|
|
61
|
-
|
|
62
|
-
/*
|
|
63
|
-
* Disallow return statements inside a callback passed to finally(),
|
|
64
|
-
* since nothing would consume what's returned.
|
|
65
|
-
*/
|
|
66
|
-
"promise/no-return-in-finally": "warn",
|
|
67
|
-
},
|
|
68
|
-
}
|