@ivanmaxlogiudice/eslint-config 0.0.2 → 0.1.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/index.js +233 -64
- package/package.json +23 -16
package/index.js
CHANGED
|
@@ -2,29 +2,71 @@ module.exports = {
|
|
|
2
2
|
env: {
|
|
3
3
|
es6: true,
|
|
4
4
|
node: true,
|
|
5
|
-
browser: true
|
|
5
|
+
browser: true,
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
reportUnusedDisableDirectives: true,
|
|
8
8
|
extends: [
|
|
9
9
|
'standard',
|
|
10
10
|
'plugin:import/recommended',
|
|
11
|
+
'plugin:eslint-comments/recommended',
|
|
11
12
|
'plugin:jsonc/recommended-with-jsonc',
|
|
12
|
-
'plugin:
|
|
13
|
+
'plugin:yml/standard',
|
|
14
|
+
'plugin:markdown/recommended',
|
|
15
|
+
'plugin:tailwindcss/recommended',
|
|
16
|
+
],
|
|
17
|
+
ignorePatterns: [
|
|
18
|
+
'*.min.*',
|
|
19
|
+
'*.d.ts',
|
|
20
|
+
'CHANGELOG.md',
|
|
21
|
+
'dist',
|
|
22
|
+
'LICENSE*',
|
|
23
|
+
'output',
|
|
24
|
+
'out',
|
|
25
|
+
'coverage',
|
|
26
|
+
'public',
|
|
27
|
+
'temp',
|
|
28
|
+
'package-lock.json',
|
|
29
|
+
'pnpm-lock.yaml',
|
|
30
|
+
'yarn.lock',
|
|
31
|
+
'__snapshots__',
|
|
32
|
+
'!.github',
|
|
33
|
+
'!.vitepress',
|
|
34
|
+
'!.vscode',
|
|
35
|
+
],
|
|
36
|
+
plugins: [
|
|
37
|
+
'html',
|
|
38
|
+
'unicorn',
|
|
39
|
+
'tailwindcss',
|
|
40
|
+
'antfu',
|
|
41
|
+
'no-only-tests',
|
|
13
42
|
],
|
|
14
43
|
settings: {
|
|
15
44
|
'import/resolver': {
|
|
16
|
-
node: { extensions: ['.js', '.mjs'
|
|
17
|
-
}
|
|
45
|
+
node: { extensions: ['.js', '.mjs'] },
|
|
46
|
+
},
|
|
18
47
|
},
|
|
19
48
|
overrides: [
|
|
20
49
|
{
|
|
21
50
|
files: ['*.json', '*.json5'],
|
|
22
51
|
parser: 'jsonc-eslint-parser',
|
|
23
52
|
rules: {
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'comma-
|
|
27
|
-
|
|
53
|
+
'jsonc/array-bracket-spacing': ['error', 'never'],
|
|
54
|
+
'jsonc/comma-dangle': ['error', 'never'],
|
|
55
|
+
'jsonc/comma-style': ['error', 'last'],
|
|
56
|
+
'jsonc/indent': ['error', 4],
|
|
57
|
+
'jsonc/key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
58
|
+
'jsonc/no-octal-escape': 'error',
|
|
59
|
+
'jsonc/object-curly-newline': ['error', { multiline: true, consistent: true }],
|
|
60
|
+
'jsonc/object-curly-spacing': ['error', 'always'],
|
|
61
|
+
'jsonc/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
files: ['*.yaml', '*.yml'],
|
|
66
|
+
parser: 'yaml-eslint-parser',
|
|
67
|
+
rules: {
|
|
68
|
+
'spaced-comment': 'off',
|
|
69
|
+
},
|
|
28
70
|
},
|
|
29
71
|
{
|
|
30
72
|
files: ['package.json'],
|
|
@@ -35,122 +77,211 @@ module.exports = {
|
|
|
35
77
|
{
|
|
36
78
|
pathPattern: '^$',
|
|
37
79
|
order: [
|
|
80
|
+
'publisher',
|
|
38
81
|
'name',
|
|
82
|
+
'displayName',
|
|
83
|
+
'type',
|
|
39
84
|
'version',
|
|
85
|
+
'private',
|
|
86
|
+
'packageManager',
|
|
40
87
|
'description',
|
|
41
|
-
'
|
|
88
|
+
'author',
|
|
42
89
|
'license',
|
|
43
|
-
'repository',
|
|
44
90
|
'funding',
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
91
|
+
'homepage',
|
|
92
|
+
'repository',
|
|
93
|
+
'bugs',
|
|
94
|
+
'keywords',
|
|
95
|
+
'categories',
|
|
96
|
+
'sideEffects',
|
|
48
97
|
'exports',
|
|
49
98
|
'main',
|
|
50
99
|
'module',
|
|
51
100
|
'unpkg',
|
|
101
|
+
'jsdelivr',
|
|
102
|
+
'types',
|
|
103
|
+
'typesVersions',
|
|
52
104
|
'bin',
|
|
105
|
+
'icon',
|
|
106
|
+
'files',
|
|
107
|
+
'engines',
|
|
108
|
+
'activationEvents',
|
|
109
|
+
'contributes',
|
|
53
110
|
'scripts',
|
|
54
|
-
'husky',
|
|
55
|
-
'lint-staged',
|
|
56
111
|
'peerDependencies',
|
|
57
112
|
'peerDependenciesMeta',
|
|
58
113
|
'dependencies',
|
|
114
|
+
'optionalDependencies',
|
|
59
115
|
'devDependencies',
|
|
60
|
-
'
|
|
61
|
-
|
|
116
|
+
'pnpm',
|
|
117
|
+
'overrides',
|
|
118
|
+
'resolutions',
|
|
119
|
+
'husky',
|
|
120
|
+
'simple-git-hooks',
|
|
121
|
+
'lint-staged',
|
|
122
|
+
'eslintConfig',
|
|
123
|
+
],
|
|
62
124
|
},
|
|
63
125
|
{
|
|
64
126
|
pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies$',
|
|
65
|
-
order: { type: 'asc' }
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
127
|
+
order: { type: 'asc' },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
pathPattern: '^exports.*$',
|
|
131
|
+
order: [
|
|
132
|
+
'types',
|
|
133
|
+
'require',
|
|
134
|
+
'import',
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
files: ['*.d.ts'],
|
|
142
|
+
rules: {
|
|
143
|
+
'import/no-duplicates': 'off',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
files: ['*.js'],
|
|
148
|
+
rules: {
|
|
149
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
|
|
154
|
+
rules: {
|
|
155
|
+
'no-void': ['error', { allowAsStatement: true }],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
files: ['scripts/**/*.*', 'cli.*'],
|
|
160
|
+
rules: {
|
|
161
|
+
'no-console': 'off',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
files: ['*.test.ts', '*.test.js', '*.spec.ts', '*.spec.js'],
|
|
166
|
+
rules: {
|
|
167
|
+
'no-unused-expressions': 'off',
|
|
168
|
+
'no-only-tests/no-only-tests': 'error',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
// Code blocks in markdown file
|
|
173
|
+
files: ['**/*.md/*.*'],
|
|
174
|
+
rules: {
|
|
175
|
+
'@typescript-eslint/no-redeclare': 'off',
|
|
176
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
177
|
+
'@typescript-eslint/no-use-before-define': 'off',
|
|
178
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
179
|
+
'@typescript-eslint/comma-dangle': 'off',
|
|
180
|
+
'@typescript-eslint/consistent-type-imports': 'off',
|
|
181
|
+
'import/no-unresolved': 'off',
|
|
182
|
+
'no-alert': 'off',
|
|
183
|
+
'no-console': 'off',
|
|
184
|
+
'no-restricted-imports': 'off',
|
|
185
|
+
'no-undef': 'off',
|
|
186
|
+
'no-unused-expressions': 'off',
|
|
187
|
+
'no-unused-vars': 'off',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
70
190
|
],
|
|
71
191
|
rules: {
|
|
72
192
|
// import
|
|
73
193
|
'import/order': 'error',
|
|
74
194
|
'import/first': 'error',
|
|
75
195
|
'import/no-mutable-exports': 'error',
|
|
196
|
+
'import/no-unresolved': 'off',
|
|
197
|
+
'import/no-absolute-path': 'off',
|
|
198
|
+
'import/no-named-as-default-member': 'off',
|
|
199
|
+
'import/no-named-as-default': 'off',
|
|
200
|
+
'import/namespace': 'off',
|
|
76
201
|
|
|
77
202
|
// Common
|
|
78
203
|
'semi': ['error', 'never'],
|
|
204
|
+
'curly': ['error', 'multi-or-nest', 'consistent'],
|
|
79
205
|
'quotes': ['error', 'single', { avoidEscape: true }],
|
|
80
|
-
'indent': [
|
|
81
|
-
'error', 4,
|
|
82
|
-
{
|
|
83
|
-
SwitchCase: 1,
|
|
84
|
-
VariableDeclarator: 1,
|
|
85
|
-
outerIIFEBody: 1
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
206
|
'quote-props': ['error', 'consistent-as-needed'],
|
|
207
|
+
'no-unused-vars': 'warn',
|
|
208
|
+
'no-param-reassign': 'off',
|
|
89
209
|
'array-bracket-spacing': ['error', 'never'],
|
|
90
|
-
|
|
91
|
-
'curly': ['error', 'multi-or-nest', 'consistent'],
|
|
210
|
+
'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
|
|
92
211
|
'block-spacing': ['error', 'always'],
|
|
212
|
+
'camelcase': 'off',
|
|
93
213
|
'comma-spacing': ['error', { before: false, after: true }],
|
|
94
214
|
'comma-style': ['error', 'last'],
|
|
95
|
-
'comma-dangle': ['error', '
|
|
215
|
+
'comma-dangle': ['error', 'always-multiline'],
|
|
216
|
+
'no-constant-condition': 'warn',
|
|
96
217
|
'no-debugger': 'error',
|
|
97
218
|
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
98
219
|
'no-cond-assign': ['error', 'always'],
|
|
99
220
|
'func-call-spacing': ['error', 'never'],
|
|
100
|
-
'key-spacing': [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
],
|
|
107
|
-
'no-use-before-define': [
|
|
221
|
+
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
222
|
+
'indent': ['error', 4, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }],
|
|
223
|
+
'no-restricted-syntax': ['error', 'DebuggerStatement', 'LabeledStatement', 'WithStatement'],
|
|
224
|
+
'object-curly-spacing': ['error', 'always'],
|
|
225
|
+
'no-return-await': 'off', //
|
|
226
|
+
'space-before-function-paren': [
|
|
108
227
|
'error',
|
|
109
228
|
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
229
|
+
anonymous: 'always',
|
|
230
|
+
named: 'never',
|
|
231
|
+
asyncArrow: 'always',
|
|
232
|
+
},
|
|
114
233
|
],
|
|
115
|
-
'no-
|
|
116
|
-
'object-curly-spacing': ['error', 'always'],
|
|
117
|
-
'space-before-function-paren': ['error', 'never'],
|
|
234
|
+
'no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
|
|
118
235
|
|
|
119
236
|
// ES6
|
|
237
|
+
'no-var': 'error',
|
|
120
238
|
'prefer-const': [
|
|
121
239
|
'error',
|
|
122
240
|
{
|
|
123
241
|
destructuring: 'any',
|
|
124
|
-
ignoreReadBeforeAssign: true
|
|
125
|
-
}
|
|
242
|
+
ignoreReadBeforeAssign: true,
|
|
243
|
+
},
|
|
126
244
|
],
|
|
127
245
|
'prefer-arrow-callback': [
|
|
128
246
|
'error',
|
|
129
247
|
{
|
|
130
248
|
allowNamedFunctions: false,
|
|
131
|
-
allowUnboundThis: true
|
|
132
|
-
}
|
|
249
|
+
allowUnboundThis: true,
|
|
250
|
+
},
|
|
133
251
|
],
|
|
134
252
|
'object-shorthand': [
|
|
135
253
|
'error',
|
|
136
254
|
'always',
|
|
137
255
|
{
|
|
138
256
|
ignoreConstructors: false,
|
|
139
|
-
avoidQuotes: true
|
|
140
|
-
}
|
|
257
|
+
avoidQuotes: true,
|
|
258
|
+
},
|
|
141
259
|
],
|
|
260
|
+
'prefer-exponentiation-operator': 'error',
|
|
142
261
|
'prefer-rest-params': 'error',
|
|
143
262
|
'prefer-spread': 'error',
|
|
144
263
|
'prefer-template': 'error',
|
|
145
264
|
'template-curly-spacing': 'error',
|
|
146
265
|
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
|
147
266
|
'generator-star-spacing': 'off',
|
|
267
|
+
'spaced-comment': ['error', 'always', {
|
|
268
|
+
line: {
|
|
269
|
+
markers: ['/'],
|
|
270
|
+
exceptions: ['/', '#'],
|
|
271
|
+
},
|
|
272
|
+
block: {
|
|
273
|
+
markers: ['!'],
|
|
274
|
+
exceptions: ['*'],
|
|
275
|
+
balanced: true,
|
|
276
|
+
},
|
|
277
|
+
}],
|
|
148
278
|
|
|
149
279
|
// Best Practice
|
|
150
280
|
'array-callback-return': 'error',
|
|
151
281
|
'block-scoped-var': 'error',
|
|
282
|
+
'consistent-return': 'off',
|
|
152
283
|
'complexity': ['off', 11],
|
|
153
|
-
'eqeqeq': ['error', '
|
|
284
|
+
'eqeqeq': ['error', 'smart'],
|
|
154
285
|
'no-alert': 'warn',
|
|
155
286
|
'no-case-declarations': 'error',
|
|
156
287
|
'no-multi-spaces': 'error',
|
|
@@ -162,23 +293,61 @@ module.exports = {
|
|
|
162
293
|
'require-await': 'off',
|
|
163
294
|
'no-return-assign': 'off',
|
|
164
295
|
'operator-linebreak': ['error', 'before'],
|
|
296
|
+
'max-statements-per-line': ['error', { max: 1 }],
|
|
165
297
|
|
|
166
298
|
// unicorns
|
|
167
|
-
|
|
168
|
-
'unicorn/no-unnecessary-await': 'error',
|
|
169
|
-
'unicorn/prefer-logical-operator-over-ternary': 'error',
|
|
299
|
+
// Pass error message when throwing errors
|
|
170
300
|
'unicorn/error-message': 'error',
|
|
301
|
+
// Uppercase regex escapes
|
|
171
302
|
'unicorn/escape-case': 'error',
|
|
172
|
-
|
|
303
|
+
// Array.isArray instead of instanceof
|
|
304
|
+
'unicorn/no-instanceof-array': 'error',
|
|
305
|
+
// Prevent deprecated `new Buffer()`
|
|
173
306
|
'unicorn/no-new-buffer': 'error',
|
|
307
|
+
// Keep regex literals safe!
|
|
174
308
|
'unicorn/no-unsafe-regex': 'off',
|
|
309
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
175
310
|
'unicorn/number-literal-case': 'error',
|
|
176
|
-
|
|
311
|
+
// includes over indexOf when checking for existence
|
|
177
312
|
'unicorn/prefer-includes': 'error',
|
|
178
|
-
|
|
313
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
314
|
+
'unicorn/prefer-string-starts-ends-with': 'error',
|
|
315
|
+
// textContent instead of innerText
|
|
179
316
|
'unicorn/prefer-text-content': 'error',
|
|
317
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
180
318
|
'unicorn/prefer-type-error': 'error',
|
|
319
|
+
// Use new when throwing error
|
|
181
320
|
'unicorn/throw-new-error': 'error',
|
|
182
|
-
|
|
183
|
-
|
|
321
|
+
// Enforce consistent brace style for case clauses
|
|
322
|
+
'unicorn/switch-case-braces': 'error',
|
|
323
|
+
// Disallow awaiting non-promise values
|
|
324
|
+
'unicorn/no-unnecessary-await': 'error',
|
|
325
|
+
// Prefer using a logical operator over a ternary
|
|
326
|
+
'unicorn/prefer-logical-operator-over-ternary': 'error',
|
|
327
|
+
// Prefer using the node: protocol when importing Node.js builtin modules
|
|
328
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
329
|
+
|
|
330
|
+
'eslint-comments/disable-enable-pair': 'off',
|
|
331
|
+
// Enforce Node.js-style error-first callback pattern is followed
|
|
332
|
+
'n/no-callback-literal': 'off',
|
|
333
|
+
|
|
334
|
+
'sort-imports': [
|
|
335
|
+
'error',
|
|
336
|
+
{
|
|
337
|
+
ignoreCase: false,
|
|
338
|
+
ignoreDeclarationSort: true,
|
|
339
|
+
ignoreMemberSort: false,
|
|
340
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
341
|
+
allowSeparatedGroups: false,
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
|
|
345
|
+
// yml
|
|
346
|
+
'yml/quotes': ['error', { prefer: 'single', avoidEscape: false }],
|
|
347
|
+
'yml/no-empty-document': 'off',
|
|
348
|
+
|
|
349
|
+
// antfu
|
|
350
|
+
'antfu/if-newline': 'error',
|
|
351
|
+
'antfu/import-dedupe': 'error',
|
|
352
|
+
},
|
|
184
353
|
}
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ivanmaxlogiudice/eslint-config",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Personal ESLint configuration",
|
|
5
|
+
"author": "Iván Máximiliano, Lo Giudice <ivanmaxlogiudice@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
5
7
|
"homepage": "https://ivanmaxlogiudice.com/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/ivanlogiudice/eslint-config.git",
|
|
11
|
+
"directory": "packages/eslint-config"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/ivanlogiudice/eslint-config/issues"
|
|
15
|
+
},
|
|
6
16
|
"keywords": [
|
|
7
17
|
"eslint",
|
|
8
18
|
"config",
|
|
9
19
|
"javascript",
|
|
10
20
|
"js"
|
|
11
21
|
],
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "https://github.com/ivanlogiudice/eslint-config.git",
|
|
16
|
-
"directory": "packages/eslint-config"
|
|
17
|
-
},
|
|
18
|
-
"author": "Iván Máximiliano, Lo Giudice <ivanmaxlogiudice@gmail.com>",
|
|
19
22
|
"files": [
|
|
20
23
|
"index.js"
|
|
21
24
|
],
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/ivanlogiudice/eslint-config/issues"
|
|
24
|
-
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
@@ -30,15 +30,22 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"eslint-config-standard": "^17.0.0",
|
|
33
|
+
"eslint-plugin-antfu": "^0.34.0",
|
|
34
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
35
|
+
"eslint-plugin-html": "^7.1.0",
|
|
33
36
|
"eslint-plugin-import": "^2.26.0",
|
|
34
|
-
"eslint-plugin-jsonc": "^2.
|
|
35
|
-
"eslint-plugin-
|
|
37
|
+
"eslint-plugin-jsonc": "^2.6.0",
|
|
38
|
+
"eslint-plugin-markdown": "^3.0.0",
|
|
39
|
+
"eslint-plugin-n": "^15.6.0",
|
|
40
|
+
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
36
41
|
"eslint-plugin-promise": "^6.1.1",
|
|
37
|
-
"eslint-plugin-tailwindcss": "^3.
|
|
38
|
-
"eslint-plugin-unicorn": "^45.0.
|
|
42
|
+
"eslint-plugin-tailwindcss": "^3.8.0",
|
|
43
|
+
"eslint-plugin-unicorn": "^45.0.2",
|
|
44
|
+
"eslint-plugin-yml": "^1.4.0",
|
|
39
45
|
"jsonc-eslint-parser": "^2.1.0"
|
|
40
46
|
},
|
|
41
47
|
"devDependencies": {
|
|
42
|
-
"eslint": "^8.
|
|
48
|
+
"eslint": "^8.31.0",
|
|
49
|
+
"typescript": "^4.9.4"
|
|
43
50
|
}
|
|
44
51
|
}
|