|
1 |
| -const WARN = "warn"; |
2 |
| -const ERROR = "error"; |
3 |
| -const OFF = "off"; |
| 1 | +const WARN = 'warn'; |
| 2 | +const ERROR = 'error'; |
| 3 | +const OFF = 'off'; |
4 | 4 |
|
5 | 5 | const COMMON_CONFIG = {
|
6 |
| - plugins: ["jsdoc", "filenames", "import", "prettier"], |
7 |
| - extends: ["prettier", "plugin:prettier/recommended"], |
| 6 | + plugins: ['jsdoc', 'filenames', 'import', 'prettier'], |
| 7 | + extends: ['prettier', 'plugin:prettier/recommended'], |
8 | 8 | rules: {
|
9 |
| - "prettier/prettier": WARN, |
10 |
| - "no-underscore-dangle": OFF, |
11 |
| - "no-debugger": WARN, |
12 |
| - "space-infix-ops": ERROR, |
13 |
| - "no-console": WARN, |
14 |
| - "wrap-iife": OFF, |
15 |
| - "no-self-assign": ERROR, |
16 |
| - "no-self-compare": ERROR, |
17 |
| - "no-loop-func": OFF, |
18 |
| - "array-callback-return": ERROR, |
| 9 | + 'prettier/prettier': WARN, |
| 10 | + 'no-underscore-dangle': OFF, |
| 11 | + 'no-debugger': WARN, |
| 12 | + 'space-infix-ops': ERROR, |
| 13 | + 'no-console': WARN, |
| 14 | + 'wrap-iife': OFF, |
| 15 | + 'no-self-assign': ERROR, |
| 16 | + 'no-self-compare': ERROR, |
| 17 | + 'no-loop-func': OFF, |
| 18 | + 'array-callback-return': ERROR, |
19 | 19 | curly: ERROR,
|
20 |
| - "no-fallthrough": OFF, |
21 |
| - "dot-notation": OFF, |
22 |
| - "prefer-const": WARN, |
23 |
| - "no-empty-function": OFF, |
24 |
| - "no-with": ERROR, |
25 |
| - "one-var": [ERROR, "never"], |
26 |
| - camelcase: [WARN, { properties: "always", ignoreImports: true }], |
27 |
| - "spaced-comment": [WARN, "always"], |
28 |
| - "capitalized-comments": [WARN, "always", { ignorePattern: "prettier" }], |
29 |
| - "no-useless-rename": WARN, |
30 |
| - "jsdoc/check-alignment": WARN, |
31 |
| - "jsdoc/check-examples": OFF, |
32 |
| - "jsdoc/check-indentation": WARN, |
33 |
| - "jsdoc/check-syntax": WARN, |
34 |
| - "jsdoc/check-tag-names": WARN, |
35 |
| - "jsdoc/check-types": WARN, |
36 |
| - "jsdoc/implements-on-classes": WARN, |
37 |
| - "jsdoc/match-description": OFF, |
38 |
| - "jsdoc/newline-after-description": WARN, |
39 |
| - "jsdoc/no-types": OFF, |
40 |
| - "jsdoc/no-undefined-types": OFF, |
41 |
| - "jsdoc/require-description": OFF, |
42 |
| - "jsdoc/require-description-complete-sentence": OFF, |
43 |
| - "jsdoc/require-example": OFF, |
44 |
| - "jsdoc/require-hyphen-before-param-description": [WARN, "never"], |
45 |
| - "jsdoc/require-param": WARN, |
46 |
| - "jsdoc/require-param-name": WARN, |
47 |
| - "jsdoc/require-returns-check": WARN, |
48 |
| - "jsdoc/require-returns-description": WARN, |
49 |
| - "jsdoc/valid-types": WARN, |
50 |
| - "filenames/match-exported": WARN, |
51 |
| - "no-useless-constructor": WARN, |
52 |
| - "jsdoc/require-jsdoc": [ |
| 20 | + 'no-fallthrough': OFF, |
| 21 | + 'dot-notation': OFF, |
| 22 | + 'prefer-const': WARN, |
| 23 | + 'no-empty-function': OFF, |
| 24 | + 'no-with': ERROR, |
| 25 | + 'one-var': [ERROR, 'never'], |
| 26 | + camelcase: [WARN, { properties: 'always', ignoreImports: true }], |
| 27 | + 'spaced-comment': [WARN, 'always'], |
| 28 | + 'capitalized-comments': OFF, |
| 29 | + 'no-useless-rename': WARN, |
| 30 | + 'jsdoc/check-alignment': WARN, |
| 31 | + 'jsdoc/check-examples': OFF, |
| 32 | + 'jsdoc/check-indentation': WARN, |
| 33 | + 'jsdoc/check-syntax': WARN, |
| 34 | + 'jsdoc/check-tag-names': WARN, |
| 35 | + 'jsdoc/check-types': WARN, |
| 36 | + 'jsdoc/implements-on-classes': WARN, |
| 37 | + 'jsdoc/match-description': OFF, |
| 38 | + 'jsdoc/newline-after-description': OFF, |
| 39 | + 'jsdoc/no-types': OFF, |
| 40 | + 'jsdoc/no-undefined-types': OFF, |
| 41 | + 'jsdoc/require-description': OFF, |
| 42 | + 'jsdoc/require-description-complete-sentence': OFF, |
| 43 | + 'jsdoc/require-example': OFF, |
| 44 | + 'jsdoc/require-hyphen-before-param-description': [WARN, 'never'], |
| 45 | + 'jsdoc/require-param': WARN, |
| 46 | + 'jsdoc/require-param-name': WARN, |
| 47 | + 'jsdoc/require-returns-check': WARN, |
| 48 | + 'jsdoc/require-returns-description': WARN, |
| 49 | + 'jsdoc/valid-types': WARN, |
| 50 | + 'filenames/match-exported': WARN, |
| 51 | + 'no-useless-constructor': WARN, |
| 52 | + 'jsdoc/require-jsdoc': [ |
53 | 53 | WARN,
|
54 | 54 | {
|
55 | 55 | require: {
|
56 | 56 | ArrowFunctionExpression: false,
|
57 | 57 | FunctionDeclaration: false,
|
58 | 58 | FunctionExpression: false,
|
59 | 59 | ClassDeclaration: true,
|
60 |
| - MethodDefinition: true, |
61 |
| - }, |
62 |
| - }, |
| 60 | + MethodDefinition: true |
| 61 | + } |
| 62 | + } |
63 | 63 | ],
|
64 |
| - "import/no-extraneous-dependencies": WARN, |
65 |
| - }, |
| 64 | + 'import/no-extraneous-dependencies': WARN |
| 65 | + } |
66 | 66 | };
|
67 | 67 |
|
68 | 68 | const TS_PARSER_FIELDS = {
|
69 |
| - parser: "@typescript-eslint/parser", |
| 69 | + parser: '@typescript-eslint/parser', |
70 | 70 | parserOptions: {
|
71 |
| - ecmaFeatures: { |
72 |
| - jsx: true, |
73 |
| - }, |
74 | 71 | ecmaVersion: 2020,
|
75 |
| - sourceType: "module", |
76 |
| - }, |
| 72 | + sourceType: 'module' |
| 73 | + } |
77 | 74 | };
|
78 | 75 |
|
79 | 76 | module.exports = {
|
80 | 77 | env: {
|
81 | 78 | es6: true,
|
82 |
| - browser: true, |
83 |
| - node: true, |
| 79 | + node: true |
| 80 | + }, |
| 81 | + parserOptions: { |
| 82 | + ecmaVersion: 2020 |
84 | 83 | },
|
85 | 84 | overrides: [
|
86 | 85 | {
|
87 |
| - files: ["*.js", "*.jsx", "*.mjs"], |
| 86 | + files: ['*.js', '*.jsx', '*.mjs', '*.cjs'], |
88 | 87 | ...TS_PARSER_FIELDS,
|
89 | 88 | plugins: COMMON_CONFIG.plugins,
|
90 | 89 | extends: COMMON_CONFIG.extends,
|
91 | 90 | rules: {
|
92 | 91 | ...COMMON_CONFIG.rules,
|
93 |
| - "no-undef": ERROR, |
94 |
| - "jsdoc/check-param-names": WARN, |
95 |
| - "jsdoc/require-param-type": WARN, |
96 |
| - "jsdoc/require-returns": WARN, |
97 |
| - "jsdoc/require-param-description": WARN, |
98 |
| - "jsdoc/require-returns-type": WARN, |
99 |
| - "consistent-return": WARN, |
100 |
| - }, |
| 92 | + 'no-undef': ERROR, |
| 93 | + 'jsdoc/check-param-names': WARN, |
| 94 | + 'jsdoc/require-param-type': WARN, |
| 95 | + 'jsdoc/require-returns': WARN, |
| 96 | + 'jsdoc/require-param-description': WARN, |
| 97 | + 'jsdoc/require-returns-type': WARN, |
| 98 | + 'consistent-return': WARN |
| 99 | + } |
101 | 100 | },
|
102 | 101 | {
|
103 |
| - files: ["*.json"], |
104 |
| - plugins: ["json"], |
105 |
| - extends: ["eslint:recommended", "plugin:json/recommended"], |
| 102 | + files: ['*.json'], |
| 103 | + plugins: ['json'], |
| 104 | + extends: ['eslint:recommended', 'plugin:json/recommended'] |
106 | 105 | },
|
107 | 106 | {
|
108 |
| - files: ["*.ts", "*.tsx"], |
109 |
| - plugins: [...COMMON_CONFIG.plugins, "@typescript-eslint"], |
| 107 | + files: ['*.ts', '*.tsx'], |
| 108 | + plugins: [...COMMON_CONFIG.plugins, '@typescript-eslint'], |
110 | 109 | ...TS_PARSER_FIELDS,
|
111 |
| - extends: [ |
112 |
| - ...COMMON_CONFIG.extends, |
113 |
| - "plugin:@typescript-eslint/recommended", |
114 |
| - ], |
| 110 | + extends: [...COMMON_CONFIG.extends, 'plugin:@typescript-eslint/recommended'], |
115 | 111 | rules: {
|
116 | 112 | ...COMMON_CONFIG.rules,
|
117 |
| - "@typescript-eslint/explicit-member-accessibility": [ |
| 113 | + '@typescript-eslint/explicit-member-accessibility': [ |
118 | 114 | ERROR,
|
119 |
| - { overrides: { constructors: "no-public" } }, |
| 115 | + { overrides: { constructors: 'no-public' } } |
120 | 116 | ],
|
121 |
| - "@typescript-eslint/no-unused-vars": OFF, // TSC is already doing this |
122 |
| - "@typescript-eslint/ban-types": OFF, // TSC is already doing this |
123 |
| - "no-undef": OFF, // TSC is already doing this |
124 |
| - "@typescript-eslint/no-var-requires": OFF, |
125 |
| - "@typescript-eslint/explicit-module-boundary-types": OFF, // TSC is already doing this |
126 |
| - "@typescript-eslint/consistent-type-assertions": [ |
| 117 | + '@typescript-eslint/no-unused-vars': OFF, // TSC is already doing this |
| 118 | + '@typescript-eslint/ban-types': OFF, // TSC is already doing this |
| 119 | + 'no-undef': OFF, // TSC is already doing this |
| 120 | + '@typescript-eslint/no-var-requires': OFF, |
| 121 | + '@typescript-eslint/explicit-module-boundary-types': OFF, // TSC is already doing this |
| 122 | + '@typescript-eslint/consistent-type-assertions': [ |
127 | 123 | WARN,
|
128 |
| - { assertionStyle: "angle-bracket" }, |
| 124 | + { assertionStyle: 'angle-bracket' } |
129 | 125 | ],
|
130 |
| - "@typescript-eslint/no-explicit-any": OFF, |
131 |
| - "@typescript-eslint/no-empty-function": OFF, |
132 |
| - "@typescript-eslint/no-use-before-define": OFF, |
133 |
| - "@typescript-eslint/no-this-alias": OFF, |
134 |
| - "@typescript-eslint/explicit-function-return-type": [ |
135 |
| - ERROR, |
136 |
| - { allowExpressions: true }, |
137 |
| - ], |
138 |
| - "@typescript-eslint/member-ordering": [ |
| 126 | + '@typescript-eslint/no-explicit-any': OFF, |
| 127 | + '@typescript-eslint/no-empty-function': OFF, |
| 128 | + '@typescript-eslint/no-use-before-define': OFF, |
| 129 | + '@typescript-eslint/no-this-alias': OFF, |
| 130 | + '@typescript-eslint/explicit-function-return-type': [ERROR, { allowExpressions: true }], |
| 131 | + '@typescript-eslint/member-ordering': [ |
139 | 132 | WARN,
|
140 | 133 | {
|
141 |
| - default: [ |
142 |
| - "signature", |
143 |
| - "field", |
144 |
| - "constructor", |
145 |
| - ["get", "set"], |
146 |
| - "method", |
147 |
| - ], |
148 |
| - }, |
| 134 | + default: ['signature', 'field', 'constructor', ['get', 'set'], 'method'] |
| 135 | + } |
149 | 136 | ],
|
150 |
| - "@typescript-eslint/ban-ts-comment": OFF, |
151 |
| - "jsdoc/no-types": WARN, |
152 |
| - "import/named": OFF, |
153 |
| - "import/no-named-as-default": WARN, |
154 |
| - "import/no-extraneous-dependencies": WARN, |
155 |
| - "import/no-absolute-path": WARN, |
156 |
| - "@typescript-eslint/naming-convention": [ |
| 137 | + '@typescript-eslint/ban-ts-comment': OFF, |
| 138 | + 'jsdoc/no-types': WARN, |
| 139 | + 'import/named': OFF, |
| 140 | + 'import/no-named-as-default': WARN, |
| 141 | + 'import/no-extraneous-dependencies': WARN, |
| 142 | + 'import/no-absolute-path': WARN, |
| 143 | + '@typescript-eslint/naming-convention': [ |
157 | 144 | WARN,
|
158 | 145 | {
|
159 |
| - selector: "interface", |
160 |
| - format: ["PascalCase"], |
161 |
| - prefix: ["I"], |
| 146 | + selector: 'interface', |
| 147 | + format: ['PascalCase'], |
| 148 | + prefix: ['I'] |
162 | 149 | },
|
163 | 150 | {
|
164 |
| - selector: "enum", |
165 |
| - format: ["PascalCase"], |
166 |
| - suffix: ["Enum"], |
| 151 | + selector: 'enum', |
| 152 | + format: ['PascalCase'], |
| 153 | + suffix: ['Enum'] |
167 | 154 | },
|
168 | 155 | {
|
169 |
| - selector: "typeParameter", |
170 |
| - format: ["PascalCase"], |
| 156 | + selector: 'typeParameter', |
| 157 | + format: ['PascalCase'] |
171 | 158 | },
|
172 | 159 | {
|
173 |
| - selector: "memberLike", |
174 |
| - modifiers: ["private"], |
175 |
| - leadingUnderscore: "allow", |
176 |
| - format: ["camelCase"], |
| 160 | + selector: 'memberLike', |
| 161 | + modifiers: ['private'], |
| 162 | + leadingUnderscore: 'allow', |
| 163 | + format: ['camelCase'] |
177 | 164 | },
|
178 | 165 | {
|
179 |
| - selector: "class", |
180 |
| - format: ["PascalCase"], |
181 |
| - }, |
182 |
| - ], |
183 |
| - }, |
184 |
| - }, |
185 |
| - ], |
| 166 | + selector: 'class', |
| 167 | + format: ['PascalCase'] |
| 168 | + } |
| 169 | + ] |
| 170 | + } |
| 171 | + } |
| 172 | + ] |
186 | 173 | };
|
0 commit comments