eslint-config-decent 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/LICENSE +21 -0
- package/README.md +20 -0
- package/dist/index.cjs +540 -0
- package/dist/index.d.cts +31 -0
- package/dist/index.d.mts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.mjs +520 -0
- package/package.json +100 -0
- package/src/eslint.ts +258 -0
- package/src/index.ts +92 -0
- package/src/jsdoc.ts +36 -0
- package/src/mocha.ts +32 -0
- package/src/promise.ts +28 -0
- package/src/security.ts +31 -0
- package/src/types/eslint-js.d.ts +9 -0
- package/src/types/eslint-plugin-mocha.d.ts +9 -0
- package/src/types/eslint-plugin-promise.d.ts +5 -0
- package/src/types/eslint-plugin-security.d.ts +5 -0
- package/src/types/eslint-plugin-unicorn.d.ts +5 -0
- package/src/typescriptEslint.ts +79 -0
- package/src/unicorn.ts +25 -0
package/src/eslint.ts
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import type { ConfigWithExtends } from 'typescript-eslint';
|
|
2
|
+
|
|
3
|
+
const base: ConfigWithExtends = {
|
|
4
|
+
rules: {
|
|
5
|
+
'array-callback-return': ['error', { allowImplicit: true }],
|
|
6
|
+
'block-scoped-var': 'error',
|
|
7
|
+
'callback-return': ['error', ['callback', 'cb', 'next', 'done']],
|
|
8
|
+
'class-methods-use-this': [
|
|
9
|
+
'error',
|
|
10
|
+
{
|
|
11
|
+
exceptMethods: [],
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
'default-case': ['error', { commentPattern: '^no default$' }],
|
|
15
|
+
'default-case-last': 'error',
|
|
16
|
+
eqeqeq: ['error', 'smart'],
|
|
17
|
+
'func-names': 'error',
|
|
18
|
+
'func-style': [
|
|
19
|
+
'error',
|
|
20
|
+
'declaration',
|
|
21
|
+
{
|
|
22
|
+
allowArrowFunctions: false,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
'global-require': 'error',
|
|
26
|
+
'grouped-accessor-pairs': 'error',
|
|
27
|
+
'guard-for-in': 'error',
|
|
28
|
+
'id-length': [
|
|
29
|
+
'error',
|
|
30
|
+
{
|
|
31
|
+
exceptions: ['_', '$', 'e', 'i', 'j', 'k', 'q', 'x', 'y'],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
'lines-around-directive': [
|
|
35
|
+
'error',
|
|
36
|
+
{
|
|
37
|
+
before: 'always',
|
|
38
|
+
after: 'always',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
'handle-callback-err': ['error', '^.*err'],
|
|
42
|
+
'max-classes-per-file': ['error', 1],
|
|
43
|
+
'object-shorthand': [
|
|
44
|
+
'error',
|
|
45
|
+
'always',
|
|
46
|
+
{
|
|
47
|
+
ignoreConstructors: false,
|
|
48
|
+
avoidQuotes: true,
|
|
49
|
+
avoidExplicitReturnArrows: true,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
'one-var': ['error', 'never'],
|
|
53
|
+
'operator-assignment': ['error', 'always'],
|
|
54
|
+
'no-await-in-loop': 'error',
|
|
55
|
+
'no-bitwise': 'error',
|
|
56
|
+
'no-buffer-constructor': 'error',
|
|
57
|
+
'no-caller': 'error',
|
|
58
|
+
'no-cond-assign': ['error', 'always'],
|
|
59
|
+
'no-console': 'error',
|
|
60
|
+
'no-constructor-return': 'error',
|
|
61
|
+
'no-else-return': ['error', { allowElseIf: false }],
|
|
62
|
+
'no-empty-static-block': 'error',
|
|
63
|
+
'no-eval': 'error',
|
|
64
|
+
'no-extend-native': 'error',
|
|
65
|
+
'no-extra-bind': 'error',
|
|
66
|
+
'no-extra-label': 'error',
|
|
67
|
+
'no-inner-declarations': 'error',
|
|
68
|
+
'no-iterator': 'error',
|
|
69
|
+
'no-label-var': 'error',
|
|
70
|
+
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
|
71
|
+
'no-lone-blocks': 'error',
|
|
72
|
+
'no-lonely-if': 'error',
|
|
73
|
+
'no-mixed-spaces-and-tabs': 'error',
|
|
74
|
+
'no-multi-assign': ['error'],
|
|
75
|
+
'no-multi-str': 'error',
|
|
76
|
+
'no-negated-condition': 'error',
|
|
77
|
+
'no-nested-ternary': 'error',
|
|
78
|
+
'no-new-object': 'error',
|
|
79
|
+
'no-new-require': 'error',
|
|
80
|
+
'no-new-wrappers': 'error',
|
|
81
|
+
'no-octal-escape': 'error',
|
|
82
|
+
'no-path-concat': 'error',
|
|
83
|
+
'no-promise-executor-return': 'error',
|
|
84
|
+
'no-proto': 'error',
|
|
85
|
+
'no-restricted-exports': [
|
|
86
|
+
'error',
|
|
87
|
+
{
|
|
88
|
+
restrictedNamedExports: [
|
|
89
|
+
'default', // use `export default` to provide a default export
|
|
90
|
+
'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
'no-restricted-globals': [
|
|
95
|
+
'error',
|
|
96
|
+
{
|
|
97
|
+
name: 'isFinite',
|
|
98
|
+
message: 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'isNaN',
|
|
102
|
+
message: 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
'no-restricted-properties': [
|
|
106
|
+
'error',
|
|
107
|
+
{
|
|
108
|
+
object: 'arguments',
|
|
109
|
+
property: 'callee',
|
|
110
|
+
message: 'arguments.callee is deprecated',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
property: '__defineGetter__',
|
|
114
|
+
message: 'Please use Object.defineProperty instead.',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
property: '__defineSetter__',
|
|
118
|
+
message: 'Please use Object.defineProperty instead.',
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
'no-restricted-syntax': ['error', 'DebuggerStatement', 'LabeledStatement', 'WithStatement'],
|
|
122
|
+
'no-return-assign': ['error', 'always'],
|
|
123
|
+
'no-self-compare': 'error',
|
|
124
|
+
'no-sequences': 'error',
|
|
125
|
+
'no-script-url': 'error',
|
|
126
|
+
'no-template-curly-in-string': 'error',
|
|
127
|
+
'no-undef-init': 'error',
|
|
128
|
+
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
129
|
+
'no-unreachable-loop': [
|
|
130
|
+
'error',
|
|
131
|
+
{
|
|
132
|
+
ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
'no-unused-expressions': [
|
|
136
|
+
'error',
|
|
137
|
+
{
|
|
138
|
+
allowShortCircuit: false,
|
|
139
|
+
allowTernary: false,
|
|
140
|
+
allowTaggedTemplates: false,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
'no-useless-computed-key': 'error',
|
|
144
|
+
'no-useless-concat': 'error',
|
|
145
|
+
'no-useless-rename': 'error',
|
|
146
|
+
'no-useless-return': 'error',
|
|
147
|
+
'padding-line-between-statements': [
|
|
148
|
+
'error',
|
|
149
|
+
{
|
|
150
|
+
blankLine: 'always',
|
|
151
|
+
prev: ['directive', 'block', 'block-like', 'multiline-block-like', 'cjs-export', 'cjs-import', 'class', 'export', 'import', 'if'],
|
|
152
|
+
next: '*',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
blankLine: 'never',
|
|
156
|
+
prev: 'directive',
|
|
157
|
+
next: 'directive',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
blankLine: 'any',
|
|
161
|
+
prev: '*',
|
|
162
|
+
next: ['if', 'for', 'cjs-import', 'import'],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
blankLine: 'any',
|
|
166
|
+
prev: ['export', 'import'],
|
|
167
|
+
next: ['export', 'import'],
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
blankLine: 'always',
|
|
171
|
+
prev: '*',
|
|
172
|
+
next: ['try', 'function', 'switch'],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
blankLine: 'always',
|
|
176
|
+
prev: 'if',
|
|
177
|
+
next: 'if',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
blankLine: 'never',
|
|
181
|
+
prev: ['return', 'throw'],
|
|
182
|
+
next: '*',
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
'prefer-const': [
|
|
186
|
+
'error',
|
|
187
|
+
{
|
|
188
|
+
destructuring: 'any',
|
|
189
|
+
ignoreReadBeforeAssign: true,
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
'prefer-exponentiation-operator': 'error',
|
|
193
|
+
'prefer-numeric-literals': 'error',
|
|
194
|
+
'prefer-object-spread': 'error',
|
|
195
|
+
'prefer-regex-literals': [
|
|
196
|
+
'error',
|
|
197
|
+
{
|
|
198
|
+
disallowRedundantWrapping: true,
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
'prefer-template': 'error',
|
|
202
|
+
'symbol-description': 'error',
|
|
203
|
+
'unicode-bom': ['error', 'never'],
|
|
204
|
+
'vars-on-top': 'error',
|
|
205
|
+
yoda: 'error',
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const cjsAndEsm: ConfigWithExtends = {
|
|
210
|
+
rules: {
|
|
211
|
+
curly: ['error', 'multi-line'],
|
|
212
|
+
'dot-notation': ['error', { allowKeywords: true }],
|
|
213
|
+
'dot-location': ['error', 'property'],
|
|
214
|
+
'getter-return': ['error', { allowImplicit: true }],
|
|
215
|
+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
|
|
216
|
+
'no-array-constructor': 'error',
|
|
217
|
+
'no-empty-function': [
|
|
218
|
+
'error',
|
|
219
|
+
{
|
|
220
|
+
allow: ['arrowFunctions', 'functions', 'methods'],
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
'no-new-func': 'error',
|
|
224
|
+
'no-new-symbol': 'error',
|
|
225
|
+
'no-return-await': 'error',
|
|
226
|
+
'no-shadow': 'error',
|
|
227
|
+
'no-undef': 'error',
|
|
228
|
+
'no-unexpected-multiline': 'error',
|
|
229
|
+
'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
|
|
230
|
+
'no-useless-constructor': 'error',
|
|
231
|
+
'no-var': 'error',
|
|
232
|
+
'prefer-arrow-callback': [
|
|
233
|
+
'error',
|
|
234
|
+
{
|
|
235
|
+
allowNamedFunctions: false,
|
|
236
|
+
allowUnboundThis: true,
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
240
|
+
'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const cjs: ConfigWithExtends = {
|
|
245
|
+
rules: {
|
|
246
|
+
strict: ['error', 'global'],
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export const configs = {
|
|
251
|
+
base,
|
|
252
|
+
cjsAndEsm,
|
|
253
|
+
cjs,
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export default {
|
|
257
|
+
configs,
|
|
258
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import tsEslint, { type ConfigWithExtends } from 'typescript-eslint';
|
|
4
|
+
import prettier from 'eslint-plugin-prettier/recommended';
|
|
5
|
+
import { configs as eslintConfigs } from './eslint.js';
|
|
6
|
+
import { configs as jsdocConfigs } from './jsdoc.js';
|
|
7
|
+
import { configs as mochaConfigs } from './mocha.js';
|
|
8
|
+
import { configs as promiseConfigs } from './promise.js';
|
|
9
|
+
import { configs as securityConfigs } from './security.js';
|
|
10
|
+
import { configs as typescriptEslintConfigs } from './typescriptEslint.js';
|
|
11
|
+
import { configs as unicornConfigs } from './unicorn.js';
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
eslintConfigs, //
|
|
15
|
+
jsdocConfigs,
|
|
16
|
+
promiseConfigs,
|
|
17
|
+
securityConfigs,
|
|
18
|
+
typescriptEslintConfigs,
|
|
19
|
+
unicornConfigs,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function defaultConfig(parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions']): ConfigWithExtends[] {
|
|
23
|
+
const languageOptions: ConfigWithExtends['languageOptions'] = {
|
|
24
|
+
globals: {
|
|
25
|
+
...globals.node,
|
|
26
|
+
},
|
|
27
|
+
parserOptions: {
|
|
28
|
+
// @ts-expect-error - This is a valid option
|
|
29
|
+
projectService: {
|
|
30
|
+
allowedDefaultProject: ['./*.js', './*.cjs', './*.mjs', './tests/**/*.ts', './tests/**/*.js', './tests/**/*.cjs', './tests/**/*.mjs'],
|
|
31
|
+
defaultProject: 'tsconfig.json',
|
|
32
|
+
},
|
|
33
|
+
tsconfigRootDir: import.meta.dirname,
|
|
34
|
+
...parserOptions,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
ignores: ['**/dist/**', '**/node_modules/**'],
|
|
41
|
+
},
|
|
42
|
+
eslint.configs.recommended,
|
|
43
|
+
...tsEslint.configs.strictTypeChecked,
|
|
44
|
+
...tsEslint.configs.stylisticTypeChecked,
|
|
45
|
+
{
|
|
46
|
+
languageOptions,
|
|
47
|
+
settings: {
|
|
48
|
+
...jsdocConfigs.base.settings,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
files: ['**/*.ts', '**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
53
|
+
plugins: {
|
|
54
|
+
...jsdocConfigs.base.plugins,
|
|
55
|
+
...promiseConfigs.base.plugins,
|
|
56
|
+
...securityConfigs.base.plugins,
|
|
57
|
+
...unicornConfigs.base.plugins,
|
|
58
|
+
},
|
|
59
|
+
rules: {
|
|
60
|
+
...eslintConfigs.base.rules,
|
|
61
|
+
...jsdocConfigs.base.rules,
|
|
62
|
+
...promiseConfigs.base.rules,
|
|
63
|
+
...securityConfigs.base.rules,
|
|
64
|
+
...unicornConfigs.base.rules,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
69
|
+
languageOptions: {
|
|
70
|
+
sourceType: 'script',
|
|
71
|
+
},
|
|
72
|
+
...eslintConfigs.cjsAndEsm,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
files: ['**/*.js', '**/*.cjs'],
|
|
76
|
+
languageOptions: {
|
|
77
|
+
sourceType: 'script',
|
|
78
|
+
},
|
|
79
|
+
...eslintConfigs.cjs,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
files: ['**/*.ts'],
|
|
83
|
+
...typescriptEslintConfigs.base,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
files: ['**/*.tests.ts', 'tests/tests.ts'],
|
|
87
|
+
|
|
88
|
+
...mochaConfigs.base,
|
|
89
|
+
},
|
|
90
|
+
prettier,
|
|
91
|
+
];
|
|
92
|
+
}
|
package/src/jsdoc.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
2
|
+
import type { ConfigWithExtends } from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
const base: ConfigWithExtends = {
|
|
5
|
+
settings: {
|
|
6
|
+
jsdoc: {
|
|
7
|
+
preferredTypes: {
|
|
8
|
+
Array: 'Array<object>',
|
|
9
|
+
'Array.': 'Array<object>',
|
|
10
|
+
'Array<>': '[]',
|
|
11
|
+
'Array.<>': '[]',
|
|
12
|
+
'Promise.<>': 'Promise<>',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
plugins: {
|
|
17
|
+
jsdoc,
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
'unicorn/better-regex': 'error',
|
|
21
|
+
'unicorn/custom-error-definition': 'error',
|
|
22
|
+
'unicorn/no-array-method-this-argument': 'error',
|
|
23
|
+
'unicorn/no-for-loop': 'error',
|
|
24
|
+
'unicorn/prefer-array-find': 'error',
|
|
25
|
+
'unicorn/prefer-object-from-entries': 'error',
|
|
26
|
+
'unicorn/prefer-set-has': 'error',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const configs = {
|
|
31
|
+
base,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
configs,
|
|
36
|
+
};
|
package/src/mocha.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import mocha from 'eslint-plugin-mocha';
|
|
2
|
+
import type { ConfigWithExtends } from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
const base: ConfigWithExtends = {
|
|
5
|
+
plugins: {
|
|
6
|
+
mocha,
|
|
7
|
+
},
|
|
8
|
+
rules: {
|
|
9
|
+
...mocha.configs.recommended.rules,
|
|
10
|
+
|
|
11
|
+
'max-classes-per-file': 'off',
|
|
12
|
+
|
|
13
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
14
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
15
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
16
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
17
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
18
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
19
|
+
|
|
20
|
+
'mocha/no-exclusive-tests': 'error',
|
|
21
|
+
'mocha/no-pending-tests': 'error',
|
|
22
|
+
'mocha/no-mocha-arrows': 'off',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const configs = {
|
|
27
|
+
base,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
configs,
|
|
32
|
+
};
|
package/src/promise.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import promise from 'eslint-plugin-promise';
|
|
2
|
+
import type { ConfigWithExtends } from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
const base: ConfigWithExtends = {
|
|
5
|
+
plugins: {
|
|
6
|
+
promise,
|
|
7
|
+
},
|
|
8
|
+
rules: {
|
|
9
|
+
'promise/always-return': 'error',
|
|
10
|
+
'promise/always-catch': 'off',
|
|
11
|
+
'promise/catch-or-return': [
|
|
12
|
+
'error',
|
|
13
|
+
{
|
|
14
|
+
allowThen: true,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
'promise/no-native': 'off',
|
|
18
|
+
'promise/param-names': 'error',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const configs = {
|
|
23
|
+
base,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
configs,
|
|
28
|
+
};
|
package/src/security.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import security from 'eslint-plugin-security';
|
|
2
|
+
import type { ConfigWithExtends } from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
const base: ConfigWithExtends = {
|
|
5
|
+
plugins: {
|
|
6
|
+
security,
|
|
7
|
+
},
|
|
8
|
+
rules: {
|
|
9
|
+
'security/detect-buffer-noassert': 'error',
|
|
10
|
+
'security/detect-child-process': 'error',
|
|
11
|
+
'security/detect-disable-mustache-escape': 'error',
|
|
12
|
+
'security/detect-eval-with-expression': 'error',
|
|
13
|
+
'security/detect-new-buffer': 'error',
|
|
14
|
+
'security/detect-no-csrf-before-method-override': 'error',
|
|
15
|
+
'security/detect-non-literal-fs-filename': 'error',
|
|
16
|
+
'security/detect-non-literal-regexp': 'error',
|
|
17
|
+
'security/detect-non-literal-require': 'error',
|
|
18
|
+
'security/detect-object-injection': 'off',
|
|
19
|
+
'security/detect-possible-timing-attacks': 'error',
|
|
20
|
+
'security/detect-pseudoRandomBytes': 'error',
|
|
21
|
+
'security/detect-unsafe-regex': 'error',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const configs = {
|
|
26
|
+
base,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
configs,
|
|
31
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ConfigWithExtends } from 'typescript-eslint';
|
|
2
|
+
|
|
3
|
+
const base: ConfigWithExtends = {
|
|
4
|
+
rules: {
|
|
5
|
+
'no-loss-of-precision': 'off',
|
|
6
|
+
'no-loop-func': 'off',
|
|
7
|
+
'no-return-await': 'off',
|
|
8
|
+
'no-unused-expressions': 'off',
|
|
9
|
+
'no-use-before-defined': 'off',
|
|
10
|
+
|
|
11
|
+
'@typescript-eslint/array-type': [
|
|
12
|
+
'error',
|
|
13
|
+
{
|
|
14
|
+
default: 'array',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
'@typescript-eslint/consistent-type-imports': 'error',
|
|
18
|
+
'@typescript-eslint/default-param-last': 'error',
|
|
19
|
+
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
20
|
+
'@typescript-eslint/explicit-member-accessibility': 'error',
|
|
21
|
+
'@typescript-eslint/naming-convention': [
|
|
22
|
+
'error',
|
|
23
|
+
{
|
|
24
|
+
selector: 'enumMember',
|
|
25
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
26
|
+
trailingUnderscore: 'forbid',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
30
|
+
'@typescript-eslint/no-loop-func': 'error',
|
|
31
|
+
'@typescript-eslint/no-redeclare': 'error',
|
|
32
|
+
'@typescript-eslint/member-ordering': [
|
|
33
|
+
'error',
|
|
34
|
+
{
|
|
35
|
+
default: [
|
|
36
|
+
'signature',
|
|
37
|
+
'private-field',
|
|
38
|
+
'public-field',
|
|
39
|
+
'protected-field',
|
|
40
|
+
'public-constructor',
|
|
41
|
+
'protected-constructor',
|
|
42
|
+
'private-constructor',
|
|
43
|
+
'public-method',
|
|
44
|
+
'protected-method',
|
|
45
|
+
'private-method',
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
'@typescript-eslint/only-throw-error': 'error',
|
|
50
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
51
|
+
'@typescript-eslint/no-extra-semi': 'error',
|
|
52
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
53
|
+
'@typescript-eslint/no-use-before-define': [
|
|
54
|
+
'error',
|
|
55
|
+
{
|
|
56
|
+
functions: true,
|
|
57
|
+
classes: true,
|
|
58
|
+
variables: true,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
'@typescript-eslint/parameter-properties': [
|
|
62
|
+
'error',
|
|
63
|
+
{
|
|
64
|
+
allow: ['readonly'],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
|
|
68
|
+
'@typescript-eslint/return-await': 'error',
|
|
69
|
+
'@typescript-eslint/sort-type-constituents': 'error',
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const configs = {
|
|
74
|
+
base,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default {
|
|
78
|
+
configs,
|
|
79
|
+
};
|
package/src/unicorn.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import unicorn from 'eslint-plugin-unicorn';
|
|
2
|
+
import type { ConfigWithExtends } from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
const base: ConfigWithExtends = {
|
|
5
|
+
plugins: {
|
|
6
|
+
unicorn,
|
|
7
|
+
},
|
|
8
|
+
rules: {
|
|
9
|
+
'unicorn/better-regex': 'error',
|
|
10
|
+
'unicorn/custom-error-definition': 'error',
|
|
11
|
+
'unicorn/no-array-method-this-argument': 'error',
|
|
12
|
+
'unicorn/no-for-loop': 'error',
|
|
13
|
+
'unicorn/prefer-array-find': 'error',
|
|
14
|
+
'unicorn/prefer-object-from-entries': 'error',
|
|
15
|
+
'unicorn/prefer-set-has': 'error',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const configs = {
|
|
20
|
+
base,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
configs,
|
|
25
|
+
};
|