@ivanmaxlogiudice/eslint-config 0.1.10 → 1.0.0-beta.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Iván Lo Giudice
3
+ Copyright (c) 2022-PRESENT Iván M. Lo Giudice<https://github.com/ivanmaxlogiudice>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,28 +1,42 @@
1
- # ESLint Config
1
+ # @ivanmaxlogiudice/eslint-config [![npm (scoped with tag)](https://flat.badgen.net/npm/v/@ivanmaxlogiudice/eslint-config)](https://npmjs.com/package/@ivanmaxlogiudice/eslint-config) [![npm](https://flat.badgen.net/npm/dt/@ivanmaxlogiudice/eslint-config)](https://npmjs.com/package/@ivanmaxlogiudice/eslint-config) #
2
2
 
3
- [![npm (scoped with tag)](https://flat.badgen.net/npm/v/@ivanmaxlogiudice/eslint-config)](https://npmjs.com/package/@ivanmaxlogiudice/eslint-config)
4
- [![npm](https://flat.badgen.net/npm/dt/@ivanmaxlogiudice/eslint-config)](https://npmjs.com/package/@ivanmaxlogiudice/eslint-config)
3
+ Personal Flat ESLint configuration for Javascript, TypeScript, Vue 2, Vue 3.
5
4
 
6
- Personal ESLint configuration
5
+ based on [@sxzz/eslint-config](https://github.com/sxzz/eslint-config)
7
6
 
8
- ## Getting Started
7
+ ## Features
8
+ - Single quotes, no semi
9
+ - Auto fix for formatting (aimed to be used standalone without Prettier)
10
+ - Designed to work with TypeScript, Vue 2 & 3 out-of-box
11
+ - Lint also for json, yaml, markdown
12
+ - Sorted imports, dangling commas
13
+ - Reasonable defaults, best practices, only one-line of config
9
14
 
10
- 1. Add the package to your devDependencies
15
+ ## Install
11
16
  ```bash
12
- $ pnpm add -D eslint @ivanmaxlogiudice/eslint-config
17
+ pnpm add -D @ivanmaxlogiudice/eslint-config
13
18
  ```
14
19
 
15
- 2. Create a `.eslintrc` file
16
- ```bash
17
- {
18
- "extends": ["@ivanmaxlogiudice/eslint-config"]
19
- }
20
+ ## Usage
21
+ ```js
22
+ // eslint.config.js
23
+ import { all } from '@ivanmaxlogiudice/eslint-config'
24
+
25
+ export default defineFlatConfig(all)
20
26
  ```
21
27
 
22
- ## TypeScript
28
+ ### Custom Config
23
29
 
24
- If you're using TypeScript, follow [Getting Started](https://github.com/ivanlogiudice/eslint-config/tree/main/packages/eslint-config-ts#getting-started).
30
+ ```js
31
+ import { config } from '@ivanmaxlogiudice/eslint-config'
32
+ export default config(
33
+ [
34
+ /* your custom config */
35
+ ],
36
+ { vue: true, markdown: true }
37
+ )
38
+ ```
25
39
 
26
- ## Vue 3 with TS
40
+ ## License
27
41
 
28
- If you're using Vue 3, follow [Getting Started](https://github.com/ivanlogiudice/eslint-config/tree/main/packages/eslint-config-vue#getting-started).
42
+ [MIT](./LICENSE) License © 2022-PRESENT [Iván M. Lo Giudice](https://github.com/ivanmaxlogiudice)
package/index.js CHANGED
@@ -1,414 +1,9 @@
1
- module.exports = {
2
- env: {
3
- es6: true,
4
- node: true,
5
- browser: true,
6
- },
7
- reportUnusedDisableDirectives: true,
8
- extends: [
9
- 'standard',
10
- 'plugin:import/recommended',
11
- 'plugin:eslint-comments/recommended',
12
- 'plugin:jsonc/recommended-with-jsonc',
13
- 'plugin:yml/standard',
14
- 'plugin:markdown/recommended',
15
- ],
16
- ignorePatterns: [
17
- '*.min.*',
18
- '*.d.ts',
19
- 'CHANGELOG.md',
20
- 'dist',
21
- 'LICENSE*',
22
- 'output',
23
- 'out',
24
- 'coverage',
25
- 'public',
26
- 'temp',
27
- 'package-lock.json',
28
- 'pnpm-lock.yaml',
29
- 'yarn.lock',
30
- '__snapshots__',
31
- // ignore for in lint-staged
32
- '*.css',
33
- '*.png',
34
- '*.ico',
35
- '*.toml',
36
- '*.patch',
37
- '*.txt',
38
- '*.crt',
39
- '*.key',
40
- 'Dockerfile',
41
- // force include
42
- '!.github',
43
- '!.vitepress',
44
- '!.vscode',
45
- // force exclude
46
- '.vitepress/cache',
47
- ],
48
- plugins: [
49
- 'html',
50
- 'unicorn',
51
- 'antfu',
52
- 'no-only-tests',
53
- 'unused-imports',
54
- ],
55
- settings: {
56
- 'import/resolver': {
57
- node: { extensions: ['.js', '.mjs'] },
58
- },
59
- },
60
- overrides: [
61
- {
62
- files: ['*.json', '*.json5', '*.jsonc'],
63
- parser: 'jsonc-eslint-parser',
64
- rules: {
65
- 'jsonc/array-bracket-spacing': ['error', 'never'],
66
- 'jsonc/comma-dangle': ['error', 'never'],
67
- 'jsonc/comma-style': ['error', 'last'],
68
- 'jsonc/indent': ['error', 4],
69
- 'jsonc/key-spacing': ['error', { beforeColon: false, afterColon: true }],
70
- 'jsonc/no-octal-escape': 'error',
71
- 'jsonc/object-curly-newline': ['error', { multiline: true, consistent: true }],
72
- 'jsonc/object-curly-spacing': ['error', 'always'],
73
- 'jsonc/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
74
- },
75
- },
76
- {
77
- files: ['*.yaml', '*.yml'],
78
- parser: 'yaml-eslint-parser',
79
- rules: {
80
- 'spaced-comment': 'off',
81
- },
82
- },
83
- {
84
- files: ['package.json'],
85
- parser: 'jsonc-eslint-parser',
86
- rules: {
87
- 'jsonc/sort-keys': [
88
- 'error',
89
- {
90
- pathPattern: '^$',
91
- order: [
92
- 'publisher',
93
- 'name',
94
- 'displayName',
95
- 'type',
96
- 'version',
97
- 'private',
98
- 'packageManager',
99
- 'description',
100
- 'author',
101
- 'license',
102
- 'funding',
103
- 'homepage',
104
- 'repository',
105
- 'bugs',
106
- 'keywords',
107
- 'categories',
108
- 'sideEffects',
109
- 'exports',
110
- 'main',
111
- 'module',
112
- 'unpkg',
113
- 'jsdelivr',
114
- 'types',
115
- 'typesVersions',
116
- 'bin',
117
- 'icon',
118
- 'files',
119
- 'engines',
120
- 'activationEvents',
121
- 'contributes',
122
- 'scripts',
123
- 'peerDependencies',
124
- 'peerDependenciesMeta',
125
- 'dependencies',
126
- 'optionalDependencies',
127
- 'devDependencies',
128
- 'pnpm',
129
- 'overrides',
130
- 'resolutions',
131
- 'husky',
132
- 'simple-git-hooks',
133
- 'lint-staged',
134
- 'eslintConfig',
135
- ],
136
- },
137
- {
138
- pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies$',
139
- order: { type: 'asc' },
140
- },
141
- {
142
- pathPattern: '^exports.*$',
143
- order: [
144
- 'types',
145
- 'require',
146
- 'import',
147
- ],
148
- },
149
- ],
150
- },
151
- },
152
- {
153
- files: ['*.d.ts'],
154
- rules: {
155
- 'import/no-duplicates': 'off',
156
- },
157
- },
158
- {
159
- files: ['*.js', '*.cjs', '*.jsx'],
160
- rules: {
161
- '@typescript-eslint/no-var-requires': 'off',
162
- '@typescript-eslint/no-require-imports': 'off',
163
- },
164
- },
165
- {
166
- files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
167
- rules: {
168
- 'no-void': ['error', { allowAsStatement: true }],
169
- },
170
- },
171
- {
172
- files: ['scripts/**/*.*', 'cli.*'],
173
- rules: {
174
- 'no-console': 'off',
175
- },
176
- },
177
- {
178
- files: ['*.test.ts', '*.test.js', '*.spec.ts', '*.spec.js'],
179
- rules: {
180
- 'no-unused-expressions': 'off',
181
- 'no-only-tests/no-only-tests': 'error',
182
- },
183
- },
184
- {
185
- // Code blocks in markdown file
186
- files: ['**/*.md/*.*'],
187
- rules: {
188
- '@typescript-eslint/no-redeclare': 'off',
189
- '@typescript-eslint/no-unused-vars': 'off',
190
- '@typescript-eslint/no-use-before-define': 'off',
191
- '@typescript-eslint/no-var-requires': 'off',
192
- '@typescript-eslint/comma-dangle': 'off',
193
- '@typescript-eslint/consistent-type-imports': 'off',
194
- '@typescript-eslint/no-namespace': 'off',
195
- '@typescript-eslint/no-require-imports': 'off',
196
- 'import/no-unresolved': 'off',
197
- 'no-alert': 'off',
198
- 'no-console': 'off',
199
- 'no-restricted-imports': 'off',
200
- 'unused-imports/no-unused-imports': 'off',
201
- 'unused-imports/no-unused-vars': 'off',
202
- 'no-undef': 'off',
203
- 'no-unused-expressions': 'off',
204
- 'no-unused-vars': 'off',
205
- 'antfu/no-cjs-exports': 'off',
206
- 'antfu/no-ts-export-equal': 'off',
207
- },
208
- },
209
- ],
210
- rules: {
211
- // import
212
- 'import/order': 'error',
213
- 'import/first': 'error',
214
- 'import/no-mutable-exports': 'error',
215
- 'import/no-unresolved': 'off',
216
- 'import/no-absolute-path': 'off',
217
- 'import/no-named-as-default-member': 'off',
218
- 'import/no-named-as-default': 'off',
219
- 'import/namespace': 'off',
220
- 'import/newline-after-import': ['error', { count: 1, considerComments: true }],
221
-
222
- // unused imports
223
- 'unused-imports/no-unused-imports': 'error',
224
- 'unused-imports/no-unused-vars': [
225
- 'warn',
226
- {
227
- vars: 'all',
228
- varsIgnorePattern: '^_',
229
- args: 'after-used',
230
- argsIgnorePattern: '^_',
231
- },
232
- ],
233
-
234
- // Common
235
- 'semi': ['error', 'never'],
236
- 'curly': ['error', 'multi-or-nest', 'consistent'],
237
- 'quotes': ['error', 'single', { avoidEscape: true }],
238
- 'quote-props': ['error', 'consistent-as-needed'],
239
- 'no-unused-vars': 'warn',
240
- 'no-param-reassign': 'off',
241
- 'array-bracket-spacing': ['error', 'never'],
242
- 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
243
- 'block-spacing': ['error', 'always'],
244
- 'camelcase': 'off',
245
- 'comma-spacing': ['error', { before: false, after: true }],
246
- 'comma-style': ['error', 'last'],
247
- 'comma-dangle': ['error', 'always-multiline'],
248
- 'no-constant-condition': 'warn',
249
- 'no-debugger': 'error',
250
- 'no-console': ['error', { allow: ['warn', 'error'] }],
251
- 'no-cond-assign': ['error', 'always'],
252
- 'func-call-spacing': ['error', 'never'],
253
- 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
254
- 'indent': ['error', 4, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }],
255
- 'no-restricted-syntax': ['error', 'DebuggerStatement', 'LabeledStatement', 'WithStatement'],
256
- 'object-curly-spacing': ['error', 'always'],
257
- 'no-return-await': 'off',
258
- 'space-before-function-paren': [
259
- 'error',
260
- {
261
- anonymous: 'always',
262
- named: 'never',
263
- asyncArrow: 'always',
264
- },
265
- ],
266
- 'no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
267
- 'no-restricted-globals': [
268
- 'error',
269
- { name: 'global', message: 'Use `globalThis` instead.' },
270
- { name: 'self', message: 'Use `globalThis` instead.' },
271
- ],
272
- 'no-restricted-properties': [
273
- 'error',
274
- { property: '__proto__', message: 'Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.' },
275
- { property: '__defineGetter__', message: 'Use `Object.defineProperty` instead.' },
276
- { property: '__defineSetter__', message: 'Use `Object.defineProperty` instead.' },
277
- { property: '__lookupGetter__', message: 'Use `Object.getOwnPropertyDescriptor` instead.' },
278
- { property: '__lookupSetter__', message: 'Use `Object.getOwnPropertyDescriptor` instead.' },
279
- ],
280
-
281
- // ES6
282
- 'no-var': 'error',
283
- 'prefer-const': [
284
- 'error',
285
- {
286
- destructuring: 'all',
287
- ignoreReadBeforeAssign: true,
288
- },
289
- ],
290
- 'prefer-arrow-callback': [
291
- 'error',
292
- {
293
- allowNamedFunctions: false,
294
- allowUnboundThis: true,
295
- },
296
- ],
297
- 'object-shorthand': [
298
- 'error',
299
- 'always',
300
- {
301
- ignoreConstructors: false,
302
- avoidQuotes: true,
303
- },
304
- ],
305
- 'prefer-exponentiation-operator': 'error',
306
- 'prefer-rest-params': 'error',
307
- 'prefer-spread': 'error',
308
- 'prefer-template': 'error',
309
- 'template-curly-spacing': 'error',
310
- 'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
311
- 'generator-star-spacing': 'off',
312
- 'spaced-comment': ['error', 'always', {
313
- line: {
314
- markers: ['/'],
315
- exceptions: ['/', '#'],
316
- },
317
- block: {
318
- markers: ['!'],
319
- exceptions: ['*'],
320
- balanced: true,
321
- },
322
- }],
323
-
324
- // Best Practice
325
- 'array-callback-return': 'error',
326
- 'block-scoped-var': 'error',
327
- 'consistent-return': 'off',
328
- 'complexity': 'off',
329
- 'eqeqeq': ['error', 'smart'],
330
- 'no-alert': 'warn',
331
- 'no-case-declarations': 'error',
332
- 'no-multi-spaces': 'error',
333
- 'no-multi-str': 'error',
334
- 'no-with': 'error',
335
- 'no-void': 'error',
336
- 'no-useless-escape': 'off',
337
- 'no-invalid-this': 'error',
338
- 'vars-on-top': 'error',
339
- 'require-await': 'off',
340
- 'no-return-assign': 'off',
341
- 'operator-linebreak': ['error', 'before'],
342
- 'max-statements-per-line': ['error', { max: 1 }],
343
-
344
- // unicorns
345
- // Pass error message when throwing errors
346
- 'unicorn/error-message': 'error',
347
- // Uppercase regex escapes
348
- 'unicorn/escape-case': 'error',
349
- // Array.isArray instead of instanceof
350
- 'unicorn/no-instanceof-array': 'error',
351
- // Prevent deprecated `new Buffer()`
352
- 'unicorn/no-new-buffer': 'error',
353
- // Keep regex literals safe!
354
- 'unicorn/no-unsafe-regex': 'off',
355
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
356
- 'unicorn/number-literal-case': 'error',
357
- // includes over indexOf when checking for existence
358
- 'unicorn/prefer-includes': 'error',
359
- // String methods startsWith/endsWith instead of more complicated stuff
360
- 'unicorn/prefer-string-starts-ends-with': 'error',
361
- // textContent instead of innerText
362
- 'unicorn/prefer-text-content': 'error',
363
- // Enforce throwing type error when throwing error while checking typeof
364
- 'unicorn/prefer-type-error': 'error',
365
- // Use new when throwing error
366
- 'unicorn/throw-new-error': 'error',
367
- // Enforce consistent brace style for case clauses
368
- 'unicorn/switch-case-braces': 'error',
369
- // Disallow awaiting non-promise values
370
- 'unicorn/no-unnecessary-await': 'error',
371
- // Prefer using a logical operator over a ternary
372
- 'unicorn/prefer-logical-operator-over-ternary': 'error',
373
- // Prefer using the node: protocol when importing Node.js builtin modules
374
- 'unicorn/prefer-node-protocol': 'error',
375
- // Prefer using number properties like `Number.isNaN` rather than `isNaN`
376
- 'unicorn/prefer-number-properties': 'error',
377
-
378
- 'eslint-comments/disable-enable-pair': 'off',
379
-
380
- // Enforce Node.js-style error-first callback pattern is followed
381
- 'n/prefer-global/buffer': ['error', 'never'],
382
- 'n/no-callback-literal': 'off',
383
-
384
- 'sort-imports': [
385
- 'error',
386
- {
387
- ignoreCase: false,
388
- ignoreDeclarationSort: true,
389
- ignoreMemberSort: false,
390
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
391
- allowSeparatedGroups: false,
392
- },
393
- ],
394
-
395
- // yml
396
- 'yml/quotes': ['error', { prefer: 'single', avoidEscape: false }],
397
- 'yml/no-empty-document': 'off',
398
-
399
- // antfu
400
- 'antfu/if-newline': 'error',
401
- 'antfu/import-dedupe': 'error',
402
-
403
- // standard
404
- // fix until https://github.com/standard/eslint-config-standard/pull/263 is accepted
405
- 'no-mixed-operators': ['error', {
406
- groups: [
407
- ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
408
- ['&&', '||', '?:'],
409
- ['in', 'instanceof'],
410
- ],
411
- allowSamePrecedence: true,
412
- }],
413
- },
414
- }
1
+ export * from './src/eslint-comments.js'
2
+ export * from './src/js.js'
3
+ export * from './src/jsonc.js'
4
+ export * from './src/markdown.js'
5
+ export * from './src/presets.js'
6
+ export * from './src/shared.js'
7
+ export * from './src/typescript.js'
8
+ export * from './src/vue.js'
9
+ export * from './src/yml.js'
package/package.json CHANGED
@@ -1,52 +1,70 @@
1
1
  {
2
2
  "name": "@ivanmaxlogiudice/eslint-config",
3
- "version": "0.1.10",
4
- "description": "Personal ESLint configuration",
5
- "author": "Iván Máximiliano, Lo Giudice <ivanmaxlogiudice@gmail.com>",
3
+ "version": "1.0.0-beta.0",
4
+ "packageManager": "pnpm@8.6.2",
5
+ "description": "Personal ESLint config",
6
+ "type": "module",
6
7
  "license": "MIT",
7
- "homepage": "https://ivanmaxlogiudice.com/",
8
+ "homepage": "https://github.com/ivanmaxlogiudice/eslint-config#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/ivanmaxlogiudice/eslint-config/issues"
11
+ },
8
12
  "repository": {
9
13
  "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"
14
+ "url": "git+https://github.com/ivanmaxlogiudice/eslint-config.git"
15
15
  },
16
- "keywords": [
17
- "eslint",
18
- "config",
19
- "javascript",
20
- "js"
21
- ],
22
16
  "files": [
23
- "index.js"
17
+ "index.js",
18
+ "src"
24
19
  ],
20
+ "main": "./index.js",
21
+ "module": "./index.js",
22
+ "types": "./index.d.ts",
23
+ "exports": {
24
+ "types": "./index.d.ts",
25
+ "require": "./index.js",
26
+ "import": "./index.js"
27
+ },
25
28
  "publishConfig": {
26
29
  "access": "public"
27
30
  },
28
31
  "peerDependencies": {
29
- "eslint": ">=8.37.0"
32
+ "eslint": "^8.0.0"
30
33
  },
31
34
  "dependencies": {
35
+ "@eslint/js": "^8.43.0",
36
+ "@typescript-eslint/eslint-plugin": "^5.59.11",
37
+ "@typescript-eslint/parser": "^5.59.11",
32
38
  "eslint-config-standard": "^17.1.0",
39
+ "eslint-define-config": "^1.20.0",
33
40
  "eslint-plugin-antfu": "^0.39.5",
34
41
  "eslint-plugin-eslint-comments": "^3.2.0",
35
- "eslint-plugin-html": "^7.1.0",
36
42
  "eslint-plugin-import": "^2.27.5",
37
- "eslint-plugin-jsonc": "^2.8.0",
43
+ "eslint-plugin-jsonc": "^2.9.0",
38
44
  "eslint-plugin-markdown": "^3.0.0",
39
45
  "eslint-plugin-n": "^16.0.0",
40
46
  "eslint-plugin-no-only-tests": "^3.1.0",
41
- "eslint-plugin-promise": "^6.1.1",
42
47
  "eslint-plugin-unicorn": "^47.0.0",
43
48
  "eslint-plugin-unused-imports": "^2.0.0",
44
- "eslint-plugin-yml": "^1.7.0",
49
+ "eslint-plugin-vue": "^9.14.1",
50
+ "eslint-plugin-yml": "^1.8.0",
51
+ "globals": "^13.20.0",
45
52
  "jsonc-eslint-parser": "^2.3.0",
53
+ "local-pkg": "^0.4.3",
54
+ "vue-eslint-parser": "^9.3.1",
46
55
  "yaml-eslint-parser": "^1.2.2"
47
56
  },
48
57
  "devDependencies": {
49
- "eslint": "^8.42.0",
58
+ "@types/node": "^20.3.1",
59
+ "bumpp": "^9.1.1",
60
+ "eslint": "^8.43.0",
50
61
  "typescript": "^5.1.3"
62
+ },
63
+ "engines": {
64
+ "node": ">=16.14.0"
65
+ },
66
+ "scripts": {
67
+ "lint": "eslint . --fix",
68
+ "release": "bumpp && pnpm publish"
51
69
  }
52
70
  }
@@ -0,0 +1,17 @@
1
+ import commentsPlugin from 'eslint-plugin-eslint-comments'
2
+
3
+ /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
4
+ export const eslintComments = [
5
+ {
6
+ plugins: {
7
+ 'eslint-comments': commentsPlugin,
8
+ },
9
+ rules: {
10
+ ...commentsPlugin.configs.recommended.rules,
11
+
12
+ 'eslint-comments/disable-enable-pair': ['error', {
13
+ allowWholeFile: true,
14
+ }],
15
+ },
16
+ },
17
+ ]