@1stg/eslint-config 5.2.6 → 5.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Change Log
2
2
 
3
+ ## 5.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#128](https://github.com/1stG/configs/pull/128) [`7228ebb`](https://github.com/1stG/configs/commit/7228ebb1d2a31b5a305258dff24b0d0ca357ad4f) Thanks [@JounQin](https://github.com/JounQin)! - feat: support `CONFIG_PREFER_PRETTIER` env
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`7228ebb`](https://github.com/1stG/configs/commit/7228ebb1d2a31b5a305258dff24b0d0ca357ad4f)]:
12
+ - @1stg/config@0.2.0
13
+
14
+ ## 5.3.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [#126](https://github.com/1stG/configs/pull/126) [`48d7542`](https://github.com/1stG/configs/commit/48d754293d6d68094792df71d56e8d7e8fc088a8) Thanks [@JounQin](https://github.com/JounQin)! - fix: support more `markup` files
19
+
20
+ ## 5.3.0
21
+
22
+ ### Minor Changes
23
+
24
+ - [#121](https://github.com/1stG/configs/pull/121) [`e23439a`](https://github.com/1stG/configs/commit/e23439a4691c6a49f6413ccfcda281c5f77dc85c) Thanks [@JounQin](https://github.com/JounQin)! - feat: add @1stg/config for sharing configs
25
+
26
+ ### Patch Changes
27
+
28
+ - [#121](https://github.com/1stG/configs/pull/121) [`e23439a`](https://github.com/1stG/configs/commit/e23439a4691c6a49f6413ccfcda281c5f77dc85c) Thanks [@JounQin](https://github.com/JounQin)! - fix(prettier): .vscode/\*.json should be considered as jsonc
29
+
30
+ - [#123](https://github.com/1stG/configs/pull/123) [`4f70fd3`](https://github.com/1stG/configs/commit/4f70fd3aeff6b1b66ccb607fcb61f59977d773c1) Thanks [@JounQin](https://github.com/JounQin)! - docs: add README files
31
+
32
+ - Updated dependencies [[`8aa8066`](https://github.com/1stG/configs/commit/8aa8066a926a3fd972a051bbbce11fab4cd35896), [`4f70fd3`](https://github.com/1stG/configs/commit/4f70fd3aeff6b1b66ccb607fcb61f59977d773c1), [`e23439a`](https://github.com/1stG/configs/commit/e23439a4691c6a49f6413ccfcda281c5f77dc85c)]:
33
+ - @1stg/config@0.1.0
34
+
3
35
  ## 5.2.6
4
36
 
5
37
  ### Patch Changes
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 1stG
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @1stg/eslint-config
2
+
3
+ Personal but Shareable ESLint Configuration for all 1stG.me projects
4
+
5
+ ## Sponsors
6
+
7
+ | 1stG | RxTS | UnTS |
8
+ | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
9
+ | [![1stG Open Collective backers and sponsors](https://opencollective.com/1stG/organizations.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers and sponsors](https://opencollective.com/rxts/organizations.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers and sponsors](https://opencollective.com/unts/organizations.svg)](https://opencollective.com/unts) |
10
+
11
+ ## Backers
12
+
13
+ | 1stG | RxTS | UnTS |
14
+ | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
15
+ | [![1stG Open Collective backers and sponsors](https://opencollective.com/1stG/individuals.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers and sponsors](https://opencollective.com/rxts/individuals.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers and sponsors](https://opencollective.com/unts/individuals.svg)](https://opencollective.com/unts) |
16
+
17
+ ## Changelog
18
+
19
+ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).
20
+
21
+ ## License
22
+
23
+ [MIT][] © [JounQin][]@[1stG.me][]
24
+
25
+ [1stg.me]: https://www.1stg.me
26
+ [jounqin]: https://GitHub.com/JounQin
27
+ [mit]: http://opensource.org/licenses/MIT
package/_util.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const path = require('node:path')
2
2
 
3
+ const { preferPrettier } = require('@1stg/config')
3
4
  const {
4
5
  isMonorepo,
5
6
  isPkgAvailable,
@@ -43,3 +44,7 @@ exports.magicNumbers = [
43
44
  -1, 0, 1, 2, 3, 5, 7, 10, 12, 15, 20, 24, 30, 31, 50, 60, 100, 365, 366, 500,
44
45
  768, 1000, 1024, 3600, 4200, 8080,
45
46
  ]
47
+
48
+ exports.prettierExtends = preferPrettier
49
+ ? ['prettier']
50
+ : ['plugin:prettier/recommended']
package/base.js CHANGED
@@ -1,7 +1,12 @@
1
1
  const { isTsAvailable } = require('@pkgr/utils')
2
2
  const { getGlobals } = require('eslint-plugin-mdx')
3
3
 
4
- const { isWebpackAvailable, magicNumbers, webpackSpecVars } = require('./_util')
4
+ const {
5
+ isWebpackAvailable,
6
+ magicNumbers,
7
+ webpackSpecVars,
8
+ prettierExtends,
9
+ } = require('./_util')
5
10
 
6
11
  module.exports = {
7
12
  extends: [
@@ -16,7 +21,7 @@ module.exports = {
16
21
  isTsAvailable && 'plugin:sonar/recommended',
17
22
  'plugin:unicorn/recommended',
18
23
  'standard',
19
- 'plugin:prettier/recommended',
24
+ ...prettierExtends,
20
25
  ].filter(Boolean),
21
26
  plugins: ['es-x', 'simple-import-sort'],
22
27
  globals: isWebpackAvailable ? getGlobals(webpackSpecVars) : undefined,
package/overrides.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const path = require('node:path')
2
2
 
3
+ const { jsoncFiles, nonJsonRcFiles, preferPrettier } = require('@1stg/config')
3
4
  const {
4
5
  isAngularAvailable,
5
6
  isReactAvailable,
@@ -11,7 +12,7 @@ const {
11
12
  tryPkg,
12
13
  } = require('@pkgr/utils')
13
14
 
14
- const { magicNumbers } = require('./_util')
15
+ const { magicNumbers, prettierExtends } = require('./_util')
15
16
 
16
17
  const configFile =
17
18
  tryFile(path.resolve('babel.config.js')) ||
@@ -68,7 +69,6 @@ exports.js = {
68
69
  const project =
69
70
  tryFile(path.resolve('tsconfig.eslint.json')) ||
70
71
  tryFile(path.resolve('tsconfig.base.json')) ||
71
- // eslint-disable-next-line sonarjs/no-duplicate-string
72
72
  tryFile(path.resolve('tsconfig.json')) ||
73
73
  tryPkg('@1stg/tsconfig')
74
74
 
@@ -92,7 +92,7 @@ const tsBase = {
92
92
  'plugin:@typescript-eslint/eslint-recommended',
93
93
  'plugin:@typescript-eslint/recommended',
94
94
  'plugin:import/typescript',
95
- 'prettier',
95
+ ...prettierExtends,
96
96
  ],
97
97
  settings: resolveSettings,
98
98
  rules: {
@@ -270,7 +270,7 @@ exports.dTs = {
270
270
  }
271
271
 
272
272
  const reactJsx = {
273
- extends: ['standard-react', 'plugin:react/recommended', 'prettier'],
273
+ extends: ['standard-react', 'plugin:react/recommended', ...prettierExtends],
274
274
  settings: {
275
275
  react: {
276
276
  version: 'detect',
@@ -321,7 +321,7 @@ exports.reactTs = {
321
321
  },
322
322
  }
323
323
 
324
- const vueExtends = ['plugin:vue/recommended', 'prettier']
324
+ const vueExtends = ['plugin:vue/recommended', ...prettierExtends]
325
325
 
326
326
  exports.vue = [
327
327
  {
@@ -346,6 +346,11 @@ exports.vue = [
346
346
  },
347
347
  {
348
348
  files: '*.vue',
349
+ extends: [
350
+ // eslint-disable-next-line sonarjs/no-duplicate-string
351
+ 'plugin:markup/recommended',
352
+ ...vueExtends,
353
+ ],
349
354
  rules: {
350
355
  'no-unused-vars': 0,
351
356
  '@typescript-eslint/no-unused-vars': 0,
@@ -355,7 +360,12 @@ exports.vue = [
355
360
 
356
361
  const svelteBase = {
357
362
  files: '*.svelte',
358
- extends: ['plugin:svelte/recommended'],
363
+ extends: [
364
+ 'plugin:markup/recommended',
365
+ 'plugin:svelte/recommended',
366
+ 'plugin:svelte/prettier',
367
+ ...prettierExtends,
368
+ ],
359
369
  rules: {
360
370
  'sonar/label-position': 0,
361
371
  'sonar/no-labels': 0,
@@ -385,7 +395,7 @@ exports.angular = [
385
395
  extends: [
386
396
  'plugin:@angular-eslint/recommended',
387
397
  'plugin:@angular-eslint/template/process-inline-templates',
388
- 'prettier',
398
+ ...prettierExtends,
389
399
  ],
390
400
  rules: {
391
401
  '@angular-eslint/prefer-on-push-component-change-detection': 1,
@@ -396,6 +406,7 @@ exports.angular = [
396
406
  extends: [
397
407
  'plugin:@angular-eslint/template/recommended',
398
408
  'plugin:markup/recommended',
409
+ ...prettierExtends,
399
410
  ],
400
411
  parser: 'angular-eslint-template-parser',
401
412
  rules: {
@@ -405,44 +416,36 @@ exports.angular = [
405
416
  allowNullOrUndefined: true,
406
417
  },
407
418
  ],
408
- 'prettier/prettier': 0,
409
419
  'spaced-comment': 0,
410
420
  },
411
421
  },
422
+ {
423
+ files: '*inline-template-*.component.html',
424
+ rules: {
425
+ 'unicorn/no-empty-file': 0,
426
+ },
427
+ },
428
+ ]
429
+
430
+ exports.markup = [
412
431
  {
413
432
  files: '*.html',
414
- excludedFiles: '*inline-template-*.component.html',
415
- extends: ['prettier'],
433
+ extends: 'plugin:markup/recommended',
416
434
  rules: {
417
435
  'prettier/prettier': [
418
- 2,
436
+ preferPrettier ? 0 : 2,
419
437
  {
420
- parser: 'angular',
438
+ parser: 'html',
421
439
  },
422
440
  ],
423
441
  },
424
442
  },
425
443
  {
426
- files: '*inline-template-*.component.html',
427
- rules: {
428
- 'unicorn/no-empty-file': 0,
429
- },
444
+ files: '*.pug',
445
+ extends: ['plugin:markup/recommended', ...prettierExtends],
430
446
  },
431
447
  ]
432
448
 
433
- exports.html = {
434
- files: '*.html',
435
- extends: 'plugin:markup/recommended',
436
- rules: {
437
- 'prettier/prettier': [
438
- 2,
439
- {
440
- parser: 'html',
441
- },
442
- ],
443
- },
444
- }
445
-
446
449
  exports.md = {
447
450
  files: '*.md',
448
451
  extends: ['plugin:mdx/recommended'],
@@ -489,18 +492,7 @@ exports.config = exports.configs = {
489
492
 
490
493
  exports.json = {
491
494
  files: ['.*rc', '*.json'],
492
- excludedFiles: [
493
- '.browserslistrc',
494
- '.npmrc',
495
- '.nvmrc',
496
- '.yarnrc',
497
- '.*shrc',
498
- 'angular.json',
499
- 'jsconfig.json',
500
- 'settings.json',
501
- 'tsconfig.json',
502
- 'tsconfig.*.json',
503
- ],
495
+ excludedFiles: [...nonJsonRcFiles, ...jsoncFiles],
504
496
  extends: [
505
497
  'plugin:jsonc/recommended-with-json',
506
498
  // eslint-disable-next-line sonarjs/no-duplicate-string
@@ -511,14 +503,7 @@ exports.json = {
511
503
  }
512
504
 
513
505
  exports.jsonc = {
514
- files: [
515
- '*.jsonc',
516
- 'angular.json',
517
- 'jsconfig.json',
518
- 'settings.json',
519
- 'tsconfig.json',
520
- 'tsconfig.*.json',
521
- ],
506
+ files: jsoncFiles,
522
507
  extends: [
523
508
  'plugin:jsonc/recommended-with-jsonc',
524
509
  'plugin:json-schema-validator/recommended',
@@ -560,9 +545,11 @@ exports.overrides = []
560
545
  isReactAvailable && exports.react,
561
546
  isReactAvailable && exports.reactHooks,
562
547
  isReactAvailable && exports.reactTs,
548
+ // The order matters, the later should to be preferred
549
+ exports.markup,
550
+ isAngularAvailable && exports.angular,
563
551
  isVueAvailable && exports.vue,
564
552
  isSvelteAvailable && exports.svelte,
565
- isAngularAvailable ? exports.angular : exports.html,
566
553
  exports.md,
567
554
  exports.mdx,
568
555
  isPkgAvailable('jest') && exports.jest,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@1stg/eslint-config",
3
- "version": "5.2.6",
4
- "description": "Personal but Shareable ESLint Configuration for all 1stG.me projects.",
3
+ "version": "5.4.0",
4
+ "description": "Personal but Shareable ESLint Configuration for all 1stG.me projects",
5
5
  "repository": "git+https://github.com/1stG/configs.git",
6
6
  "homepage": "https://github.com/1stG/configs/tree/master/packages/eslint-config",
7
7
  "author": "JounQin (https://www.1stG.me) <admin@1stg.me>",
@@ -45,9 +45,10 @@
45
45
  "eslint": ">=6.0.0"
46
46
  },
47
47
  "dependencies": {
48
- "@angular-eslint/eslint-plugin": "^14.0.0",
49
- "@angular-eslint/eslint-plugin-template": "^14.0.0",
50
- "@angular-eslint/template-parser": "^14.0.0",
48
+ "@1stg/config": "^0.2.0",
49
+ "@angular-eslint/eslint-plugin": "^14.0.2",
50
+ "@angular-eslint/eslint-plugin-template": "^14.0.2",
51
+ "@angular-eslint/template-parser": "^14.0.2",
51
52
  "@babel/eslint-parser": "^7.18.2",
52
53
  "@babel/eslint-plugin": "^7.17.7",
53
54
  "@pkgr/utils": "^2.3.0",
@@ -59,16 +60,16 @@
59
60
  "eslint-config-standard-jsx": "^11.0.0",
60
61
  "eslint-config-standard-react": "^11.0.1",
61
62
  "eslint-formatter-friendly": "^7.0.0",
62
- "eslint-import-resolver-typescript": "^3.2.1",
63
+ "eslint-import-resolver-typescript": "^3.2.5",
63
64
  "eslint-plugin-css": "^0.6.0",
64
65
  "eslint-plugin-es-x": "^5.2.1",
65
66
  "eslint-plugin-eslint-comments": "^3.2.0",
66
67
  "eslint-plugin-import": "^2.26.0",
67
68
  "eslint-plugin-jest": "^26.5.3",
68
69
  "eslint-plugin-jsdoc": "^39.3.3",
69
- "eslint-plugin-json-schema-validator": "^3.1.2",
70
+ "eslint-plugin-json-schema-validator": "^3.2.0",
70
71
  "eslint-plugin-jsonc": "^2.3.1",
71
- "eslint-plugin-markup": "^0.9.0",
72
+ "eslint-plugin-markup": "^0.10.0",
72
73
  "eslint-plugin-mdx": "^2.0.1",
73
74
  "eslint-plugin-n": "^15.2.4",
74
75
  "eslint-plugin-prettier": "^4.2.1",
@@ -79,13 +80,13 @@
79
80
  "eslint-plugin-simple-import-sort": "^7.0.0",
80
81
  "eslint-plugin-sonar": "^0.8.0",
81
82
  "eslint-plugin-sonarjs": "^0.13.0",
82
- "eslint-plugin-svelte": "^2.1.0",
83
+ "eslint-plugin-svelte": "^2.2.0",
83
84
  "eslint-plugin-toml": "^0.3.1",
84
- "eslint-plugin-unicorn": "^43.0.0",
85
- "eslint-plugin-vue": "^9.1.1",
85
+ "eslint-plugin-unicorn": "^43.0.1",
86
+ "eslint-plugin-vue": "^9.2.0",
86
87
  "eslint-plugin-yml": "^1.0.0"
87
88
  },
88
89
  "publishConfig": {
89
90
  "access": "public"
90
91
  }
91
- }
92
+ }