@1stg/eslint-config 5.3.0 → 5.4.1

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,28 @@
1
1
  # Change Log
2
2
 
3
+ ## 5.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#131](https://github.com/1stG/configs/pull/131) [`1e06825`](https://github.com/1stG/configs/commit/1e068259c54b12751960dbdc8acaa07949134f0f) Thanks [@JounQin](https://github.com/JounQin)! - fix(eslint): disable prettier/prettier rule for md/mdx automatically
8
+
9
+ ## 5.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#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
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`7228ebb`](https://github.com/1stG/configs/commit/7228ebb1d2a31b5a305258dff24b0d0ca357ad4f)]:
18
+ - @1stg/config@0.2.0
19
+
20
+ ## 5.3.1
21
+
22
+ ### Patch Changes
23
+
24
+ - [#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
25
+
3
26
  ## 5.3.0
4
27
 
5
28
  ### Minor 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/_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,6 +1,6 @@
1
1
  const path = require('node:path')
2
2
 
3
- const { jsoncFiles, nonJsonRcFiles } = require('@1stg/config')
3
+ const { jsoncFiles, nonJsonRcFiles, preferPrettier } = require('@1stg/config')
4
4
  const {
5
5
  isAngularAvailable,
6
6
  isReactAvailable,
@@ -12,7 +12,7 @@ const {
12
12
  tryPkg,
13
13
  } = require('@pkgr/utils')
14
14
 
15
- const { magicNumbers } = require('./_util')
15
+ const { magicNumbers, prettierExtends } = require('./_util')
16
16
 
17
17
  const configFile =
18
18
  tryFile(path.resolve('babel.config.js')) ||
@@ -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,
@@ -356,9 +361,10 @@ exports.vue = [
356
361
  const svelteBase = {
357
362
  files: '*.svelte',
358
363
  extends: [
364
+ 'plugin:markup/recommended',
359
365
  'plugin:svelte/recommended',
360
366
  'plugin:svelte/prettier',
361
- 'plugin:prettier/recommended',
367
+ ...prettierExtends,
362
368
  ],
363
369
  rules: {
364
370
  'sonar/label-position': 0,
@@ -389,7 +395,7 @@ exports.angular = [
389
395
  extends: [
390
396
  'plugin:@angular-eslint/recommended',
391
397
  'plugin:@angular-eslint/template/process-inline-templates',
392
- 'prettier',
398
+ ...prettierExtends,
393
399
  ],
394
400
  rules: {
395
401
  '@angular-eslint/prefer-on-push-component-change-detection': 1,
@@ -400,6 +406,7 @@ exports.angular = [
400
406
  extends: [
401
407
  'plugin:@angular-eslint/template/recommended',
402
408
  'plugin:markup/recommended',
409
+ ...prettierExtends,
403
410
  ],
404
411
  parser: 'angular-eslint-template-parser',
405
412
  rules: {
@@ -409,47 +416,42 @@ exports.angular = [
409
416
  allowNullOrUndefined: true,
410
417
  },
411
418
  ],
412
- 'prettier/prettier': 0,
413
419
  'spaced-comment': 0,
414
420
  },
415
421
  },
422
+ {
423
+ files: '*inline-template-*.component.html',
424
+ rules: {
425
+ 'unicorn/no-empty-file': 0,
426
+ },
427
+ },
428
+ ]
429
+
430
+ exports.markup = [
416
431
  {
417
432
  files: '*.html',
418
- excludedFiles: '*inline-template-*.component.html',
419
- extends: ['prettier'],
433
+ extends: 'plugin:markup/recommended',
420
434
  rules: {
421
435
  'prettier/prettier': [
422
- 2,
436
+ preferPrettier ? 0 : 2,
423
437
  {
424
- parser: 'angular',
438
+ parser: 'html',
425
439
  },
426
440
  ],
427
441
  },
428
442
  },
429
443
  {
430
- files: '*inline-template-*.component.html',
431
- rules: {
432
- 'unicorn/no-empty-file': 0,
433
- },
444
+ files: '*.pug',
445
+ extends: ['plugin:markup/recommended', ...prettierExtends],
434
446
  },
435
447
  ]
436
448
 
437
- exports.html = {
438
- files: '*.html',
439
- extends: 'plugin:markup/recommended',
440
- rules: {
441
- 'prettier/prettier': [
442
- 2,
443
- {
444
- parser: 'html',
445
- },
446
- ],
447
- },
448
- }
449
-
450
449
  exports.md = {
451
450
  files: '*.md',
452
451
  extends: ['plugin:mdx/recommended'],
452
+ rules: {
453
+ 'prettier/prettier': preferPrettier ? 0 : 2,
454
+ },
453
455
  }
454
456
 
455
457
  exports.mdx = {
@@ -457,6 +459,9 @@ exports.mdx = {
457
459
  extends: [...reactJsx.extends, 'plugin:mdx/recommended'],
458
460
  parserOptions: jsBase.parserOptions,
459
461
  settings: { ...reactJsx.settings, ...resolveSettings },
462
+ rules: {
463
+ 'prettier/prettier': preferPrettier ? 0 : 2,
464
+ },
460
465
  }
461
466
 
462
467
  const nonSourceRules = {
@@ -546,9 +551,11 @@ exports.overrides = []
546
551
  isReactAvailable && exports.react,
547
552
  isReactAvailable && exports.reactHooks,
548
553
  isReactAvailable && exports.reactTs,
554
+ // The order matters, the later should to be preferred
555
+ exports.markup,
556
+ isAngularAvailable && exports.angular,
549
557
  isVueAvailable && exports.vue,
550
558
  isSvelteAvailable && exports.svelte,
551
- isAngularAvailable ? exports.angular : exports.html,
552
559
  exports.md,
553
560
  exports.mdx,
554
561
  isPkgAvailable('jest') && exports.jest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1stg/eslint-config",
3
- "version": "5.3.0",
3
+ "version": "5.4.1",
4
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",
@@ -45,10 +45,10 @@
45
45
  "eslint": ">=6.0.0"
46
46
  },
47
47
  "dependencies": {
48
- "@1stg/config": "^0.1.0",
49
- "@angular-eslint/eslint-plugin": "^14.0.0",
50
- "@angular-eslint/eslint-plugin-template": "^14.0.0",
51
- "@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",
52
52
  "@babel/eslint-parser": "^7.18.2",
53
53
  "@babel/eslint-plugin": "^7.17.7",
54
54
  "@pkgr/utils": "^2.3.0",
@@ -60,14 +60,14 @@
60
60
  "eslint-config-standard-jsx": "^11.0.0",
61
61
  "eslint-config-standard-react": "^11.0.1",
62
62
  "eslint-formatter-friendly": "^7.0.0",
63
- "eslint-import-resolver-typescript": "^3.2.4",
63
+ "eslint-import-resolver-typescript": "^3.2.5",
64
64
  "eslint-plugin-css": "^0.6.0",
65
65
  "eslint-plugin-es-x": "^5.2.1",
66
66
  "eslint-plugin-eslint-comments": "^3.2.0",
67
67
  "eslint-plugin-import": "^2.26.0",
68
68
  "eslint-plugin-jest": "^26.5.3",
69
69
  "eslint-plugin-jsdoc": "^39.3.3",
70
- "eslint-plugin-json-schema-validator": "^3.1.3",
70
+ "eslint-plugin-json-schema-validator": "^3.2.0",
71
71
  "eslint-plugin-jsonc": "^2.3.1",
72
72
  "eslint-plugin-markup": "^0.10.0",
73
73
  "eslint-plugin-mdx": "^2.0.1",
@@ -82,11 +82,11 @@
82
82
  "eslint-plugin-sonarjs": "^0.13.0",
83
83
  "eslint-plugin-svelte": "^2.2.0",
84
84
  "eslint-plugin-toml": "^0.3.1",
85
- "eslint-plugin-unicorn": "^43.0.0",
85
+ "eslint-plugin-unicorn": "^43.0.1",
86
86
  "eslint-plugin-vue": "^9.2.0",
87
87
  "eslint-plugin-yml": "^1.0.0"
88
88
  },
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  }
92
- }
92
+ }