@cherepanov.pavel/shareable-config 1.0.2 → 1.0.4

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.
Files changed (49) hide show
  1. package/.editorconfig +2 -3
  2. package/.editorconfig-get.js +3 -3
  3. package/.get-all.js +16 -12
  4. package/.gitattributes-get.js +3 -3
  5. package/.gitignore-get.js +33 -30
  6. package/.vscode/.code-snippets-get.js +34 -31
  7. package/.vscode/extensions.json +17 -17
  8. package/.vscode/extensions.json-get.js +25 -25
  9. package/.vscode/settings.json +36 -27
  10. package/.vscode/settings.json-get.js +25 -25
  11. package/README.md +13 -3
  12. package/env.json5.set.js +1 -1
  13. package/jsconfig.json +4 -7
  14. package/package.json +11 -1
  15. package/tools/eslint-config/configs/global.js +21 -18
  16. package/tools/eslint-config/configs/javascript.js +14 -14
  17. package/tools/eslint-config/configs/json.js +93 -0
  18. package/tools/eslint-config/configs/typescript.js +17 -17
  19. package/tools/eslint-config/configs/vue.js +22 -22
  20. package/tools/eslint-config/index.js +1 -0
  21. package/tools/eslint-config/rules/constants.js +10 -9
  22. package/tools/eslint-config/rules/javascript/index.js +2 -2
  23. package/tools/eslint-config/rules/javascript/possible-problems.js +76 -58
  24. package/tools/eslint-config/rules/javascript/suggestions.js +405 -249
  25. package/tools/eslint-config/rules/stylistic/jsFormatting.js +321 -167
  26. package/tools/eslint-config/rules/stylistic/tsFormatting.js +4 -4
  27. package/tools/eslint-config/rules/typescript/common.js +135 -126
  28. package/tools/eslint-config/rules/typescript/compatibility.js +20 -20
  29. package/tools/eslint-config/rules/typescript/extension.js +44 -44
  30. package/tools/eslint-config/rules/typescript/index.js +3 -3
  31. package/tools/eslint-config/rules/vue/base.js +2 -2
  32. package/tools/eslint-config/rules/vue/extension.js +47 -44
  33. package/tools/eslint-config/rules/vue/formatting.js +66 -36
  34. package/tools/eslint-config/rules/vue/index.js +5 -5
  35. package/tools/eslint-config/rules/vue/possibleProblems.js +182 -109
  36. package/tools/eslint-config/rules/vue/suggestions.js +82 -79
  37. package/tools/stylelint-config/config.js +18 -20
  38. package/tools/stylelint-config/rules/base.js +30 -24
  39. package/tools/stylelint-config/rules/conflicts.js +5 -5
  40. package/tools/stylelint-config/rules/order.js +38 -38
  41. package/tools/stylelint-config/rules/property-groups.js +392 -389
  42. package/tools/stylelint-config/rules/scss.js +9 -6
  43. package/tools/stylelint-config/rules/stylistic.js +110 -109
  44. package/utils/communication.js +26 -26
  45. package/utils/copy-with-override.js +35 -33
  46. package/utils/env.js +4 -4
  47. package/utils/file-header.js +9 -9
  48. package/utils/file.js +46 -46
  49. package/utils/merge.js +161 -155
@@ -0,0 +1,93 @@
1
+ import { defineConfig } from 'eslint/config';
2
+ import jsonc from 'eslint-plugin-jsonc';
3
+ import { ERROR } from '../rules/severity';
4
+ import { jsFormatting } from '../rules/stylistic/index.js';
5
+
6
+ const JSON_BUT_JSONC_FILES = [
7
+ '**/.vscode/*.json',
8
+ '**/tsconfig*.json',
9
+ ];
10
+ const COMMON_RULES = {
11
+ 'jsonc/no-bigint-literals': ERROR,
12
+ 'jsonc/no-binary-expression': ERROR,
13
+ 'jsonc/no-binary-numeric-literals': ERROR,
14
+ 'jsonc/no-escape-sequence-in-identifier': ERROR,
15
+ 'jsonc/no-hexadecimal-numeric-literals': ERROR,
16
+ 'jsonc/no-nan': ERROR,
17
+ 'jsonc/no-number-props': ERROR,
18
+ 'jsonc/no-numeric-separators': ERROR,
19
+ 'jsonc/no-octal-numeric-literals': ERROR,
20
+ 'jsonc/no-parenthesized': ERROR,
21
+ 'jsonc/no-plus-sign': ERROR,
22
+ 'jsonc/no-regexp-literals': ERROR,
23
+ 'jsonc/no-template-literals': ERROR,
24
+ 'jsonc/no-undefined-value': ERROR,
25
+ 'jsonc/no-unicode-codepoint-escapes': ERROR,
26
+ 'jsonc/array-bracket-newline': jsFormatting['@stylistic/array-bracket-newline'],
27
+ 'jsonc/array-bracket-spacing': jsFormatting['@stylistic/array-bracket-spacing'],
28
+ 'jsonc/array-element-newline': jsFormatting['@stylistic/array-element-newline'],
29
+ 'jsonc/indent': [
30
+ jsFormatting['@stylistic/indent'][0],
31
+ jsFormatting['@stylistic/indent'][1],
32
+ ],
33
+ 'jsonc/comma-dangle': jsFormatting['@stylistic/comma-dangle'],
34
+ };
35
+ const JSON_RULES = {
36
+ 'jsonc/no-comments': ERROR,
37
+ 'jsonc/comma-dangle': [
38
+ ERROR,
39
+ 'never',
40
+ ],
41
+ };
42
+ const JSON_JSONC_RULES = {
43
+ 'jsonc/no-infinity': ERROR,
44
+ };
45
+
46
+
47
+ export default defineConfig([
48
+ {
49
+ plugins: {
50
+ jsonc,
51
+ },
52
+ },
53
+
54
+ {
55
+ files: ['**/*.json'],
56
+ ignores: [
57
+ ...JSON_BUT_JSONC_FILES,
58
+ 'package-lock.json',
59
+ ],
60
+ language: 'jsonc/json',
61
+ rules: {
62
+ ...COMMON_RULES,
63
+ ...JSON_JSONC_RULES,
64
+ ...JSON_RULES,
65
+ },
66
+ },
67
+
68
+ {
69
+ files: [
70
+ '**/*.jsonc',
71
+ ...JSON_BUT_JSONC_FILES,
72
+ ],
73
+ language: 'jsonc/jsonc',
74
+ rules: {
75
+ ...COMMON_RULES,
76
+ ...JSON_JSONC_RULES,
77
+ },
78
+ },
79
+
80
+ {
81
+ files: ['**/*.json5'],
82
+ language: 'jsonc/json5',
83
+ rules: {
84
+ ...COMMON_RULES,
85
+ },
86
+ },
87
+ {
88
+ files: ['**/*.vue'],
89
+ rules: {
90
+ 'jsonc/vue-custom-block/no-parsing-error': ERROR,
91
+ },
92
+ },
93
+ ]);
@@ -8,21 +8,21 @@ import tsParser from '@typescript-eslint/parser';
8
8
  import { jsRules } from '../rules/javascript/index.js';
9
9
 
10
10
  export default {
11
- files: ['**/*.*ts'],
12
- plugins: {
13
- '@typescript-eslint': tsPlugin,
14
- '@stylistic': stylisticPlugin,
15
- },
16
- languageOptions: {
17
- parser: tsParser,
18
- parserOptions: {
19
- projectService: true,
20
- },
21
- },
22
- rules: {
23
- ...jsRules,
24
- ...jsFormatting,
25
- ...tsRules,
26
- ...tsFormatting,
27
- },
11
+ files: ['**/*.*ts'],
12
+ plugins: {
13
+ '@typescript-eslint': tsPlugin,
14
+ '@stylistic': stylisticPlugin,
15
+ },
16
+ languageOptions: {
17
+ parser: tsParser,
18
+ parserOptions: {
19
+ projectService: true,
20
+ },
21
+ },
22
+ rules: {
23
+ ...jsRules,
24
+ ...jsFormatting,
25
+ ...tsRules,
26
+ ...tsFormatting,
27
+ },
28
28
  };
@@ -14,30 +14,30 @@ import { getEnvs } from '../../../utils/env.js';
14
14
 
15
15
  // https://github.com/sveltejs/eslint-plugin-svelte/issues/152#issuecomment-1150803175
16
16
  const {
17
- isRepositoryUseTypescript: isTs,
17
+ isRepositoryUseTypescript: isTs,
18
18
  } = await getEnvs();
19
19
 
20
20
  export default {
21
- files: ['**/*.vue'],
22
- plugins: {
23
- 'vue': vuePlugin,
24
- '@stylistic': stylisticPlugin,
21
+ files: ['**/*.vue'],
22
+ plugins: {
23
+ 'vue': vuePlugin,
24
+ '@stylistic': stylisticPlugin,
25
25
 
26
- ...(isTs ? { '@typescript-eslint': tsPlugin } : {}),
27
- },
28
- languageOptions: {
29
- parser: vueParser,
30
- parserOptions: {
31
- parser: isTs ? tsParser : 'espree',
32
- ...(isTs ? { projectService: true } : {}),
33
- extraFileExtensions: ['.vue'],
34
- },
35
- },
36
- rules: {
37
- ...jsRules,
38
- ...jsFormatting,
39
- ...(isTs ? tsRules : {}),
40
- ...(isTs ? tsFormatting : {}),
41
- ...vueRules,
42
- },
26
+ ...(isTs ? { '@typescript-eslint': tsPlugin } : {}),
27
+ },
28
+ languageOptions: {
29
+ parser: vueParser,
30
+ parserOptions: {
31
+ parser: isTs ? tsParser : 'espree',
32
+ ...(isTs ? { projectService: true } : {}),
33
+ extraFileExtensions: ['.vue'],
34
+ },
35
+ },
36
+ rules: {
37
+ ...jsRules,
38
+ ...jsFormatting,
39
+ ...(isTs ? tsRules : {}),
40
+ ...(isTs ? tsFormatting : {}),
41
+ ...vueRules,
42
+ },
43
43
  };
@@ -1,4 +1,5 @@
1
1
  export { default as globalConfig } from './configs/global.js';
2
+ export { default as jsonConfig } from './configs/json.js';
2
3
  export { default as vueConfig } from './configs/vue.js';
3
4
  export { default as jsConfig } from './configs/javascript.js';
4
5
  export { default as tsConfig } from './configs/typescript.js';
@@ -1,15 +1,16 @@
1
- export const INDENT_SIZE = 2;
1
+ export const INDENT_SIZE = 'tab';
2
+ export const TAB_WIDTH = 2;
2
3
  export const STR_LENGTH = 100;
3
4
 
4
5
  export const MAX_LEN = {
5
- code: STR_LENGTH,
6
- tabWidth: INDENT_SIZE,
6
+ code: STR_LENGTH,
7
+ tabWidth: TAB_WIDTH,
7
8
 
8
- ignoreComments: false,
9
- ignoreTrailingComments: false,
9
+ ignoreComments: false,
10
+ ignoreTrailingComments: false,
10
11
 
11
- ignoreUrls: true,
12
- ignoreStrings: true,
13
- ignoreTemplateLiterals: true,
14
- ignoreRegExpLiterals: true,
12
+ ignoreUrls: true,
13
+ ignoreStrings: true,
14
+ ignoreTemplateLiterals: true,
15
+ ignoreRegExpLiterals: true,
15
16
  };
@@ -2,6 +2,6 @@ import { possibleProblemRules } from './possible-problems.js';
2
2
  import { suggestionRules } from './suggestions.js';
3
3
 
4
4
  export const jsRules = {
5
- ...possibleProblemRules,
6
- ...suggestionRules,
5
+ ...possibleProblemRules,
6
+ ...suggestionRules,
7
7
  };
@@ -1,62 +1,80 @@
1
1
  import { ERROR, WARN } from '../severity.js';
2
2
 
3
3
  export const possibleProblemRules = {
4
- 'array-callback-return': [WARN, { checkForEach: true }],
5
- 'constructor-super': [ERROR],
6
- 'for-direction': [ERROR],
7
- 'getter-return': [ERROR, { allowImplicit: true }],
8
- 'no-async-promise-executor': [ERROR],
9
- 'no-await-in-loop': [ERROR],
10
- 'no-class-assign': [ERROR],
11
- 'no-compare-neg-zero': [ERROR],
12
- 'no-cond-assign': [ERROR, 'always'],
13
- 'no-const-assign': [ERROR],
14
- 'no-constant-binary-expression': [ERROR],
15
- 'no-constant-condition': [ERROR],
16
- 'no-constructor-return': [ERROR],
17
- 'no-control-regex': [ERROR],
18
- 'no-debugger': [ERROR],
19
- 'no-dupe-args': [ERROR],
20
- 'no-dupe-class-members': [ERROR],
21
- 'no-dupe-else-if': [ERROR],
22
- 'no-dupe-keys': [ERROR],
23
- 'no-duplicate-case': [ERROR],
24
- 'no-duplicate-imports': [ERROR],
25
- 'no-empty-character-class': [ERROR],
26
- 'no-empty-pattern': [ERROR],
27
- 'no-ex-assign': [ERROR],
28
- 'no-fallthrough': [ERROR],
29
- 'no-func-assign': [ERROR],
30
- 'no-import-assign': [ERROR],
31
- 'no-inner-declarations': [ERROR],
32
- 'no-invalid-regexp': [ERROR],
33
- 'no-irregular-whitespace': [ERROR],
34
- 'no-loss-of-precision': [ERROR],
35
- 'no-misleading-character-class': [ERROR],
36
- 'no-new-native-nonconstructor': [ERROR],
37
- 'no-new-symbol': [ERROR],
38
- 'no-obj-calls': [ERROR],
39
- 'no-promise-executor-return': [ERROR],
40
- 'no-prototype-builtins': [ERROR],
41
- 'no-self-assign': [ERROR],
42
- 'no-self-compare': [ERROR],
43
- 'no-setter-return': [ERROR],
44
- 'no-sparse-arrays': [ERROR],
45
- 'no-template-curly-in-string': [ERROR],
46
- 'no-this-before-super': [ERROR],
47
- 'no-undef': [ERROR],
48
- 'no-unexpected-multiline': [ERROR],
49
- 'no-unmodified-loop-condition': [ERROR],
50
- 'no-unreachable': [ERROR],
51
- 'no-unreachable-loop': [ERROR],
52
- 'no-unsafe-finally': [ERROR],
53
- 'no-unsafe-negation': [ERROR],
54
- 'no-unsafe-optional-chaining': [ERROR, { disallowArithmeticOperators: true }],
55
- 'no-unused-private-class-members': [ERROR],
56
- 'no-unused-vars': [WARN],
57
- 'no-use-before-define': [ERROR, { classes: true, functions: true, variables: true }],
58
- 'no-useless-backreference': [ERROR],
59
- 'require-atomic-updates': [ERROR],
60
- 'use-isnan': [ERROR],
61
- 'valid-typeof': [ERROR, { requireStringLiterals: true }],
4
+ 'array-callback-return': [
5
+ WARN,
6
+ { checkForEach: true },
7
+ ],
8
+ 'constructor-super': [ERROR],
9
+ 'for-direction': [ERROR],
10
+ 'getter-return': [
11
+ ERROR,
12
+ { allowImplicit: true },
13
+ ],
14
+ 'no-async-promise-executor': [ERROR],
15
+ 'no-await-in-loop': [ERROR],
16
+ 'no-class-assign': [ERROR],
17
+ 'no-compare-neg-zero': [ERROR],
18
+ 'no-cond-assign': [
19
+ ERROR,
20
+ 'always',
21
+ ],
22
+ 'no-const-assign': [ERROR],
23
+ 'no-constant-binary-expression': [ERROR],
24
+ 'no-constant-condition': [ERROR],
25
+ 'no-constructor-return': [ERROR],
26
+ 'no-control-regex': [ERROR],
27
+ 'no-debugger': [ERROR],
28
+ 'no-dupe-args': [ERROR],
29
+ 'no-dupe-class-members': [ERROR],
30
+ 'no-dupe-else-if': [ERROR],
31
+ 'no-dupe-keys': [ERROR],
32
+ 'no-duplicate-case': [ERROR],
33
+ 'no-duplicate-imports': [ERROR],
34
+ 'no-empty-character-class': [ERROR],
35
+ 'no-empty-pattern': [ERROR],
36
+ 'no-ex-assign': [ERROR],
37
+ 'no-fallthrough': [ERROR],
38
+ 'no-func-assign': [ERROR],
39
+ 'no-import-assign': [ERROR],
40
+ 'no-inner-declarations': [ERROR],
41
+ 'no-invalid-regexp': [ERROR],
42
+ 'no-irregular-whitespace': [ERROR],
43
+ 'no-loss-of-precision': [ERROR],
44
+ 'no-misleading-character-class': [ERROR],
45
+ 'no-new-native-nonconstructor': [ERROR],
46
+ 'no-new-symbol': [ERROR],
47
+ 'no-obj-calls': [ERROR],
48
+ 'no-promise-executor-return': [ERROR],
49
+ 'no-prototype-builtins': [ERROR],
50
+ 'no-self-assign': [ERROR],
51
+ 'no-self-compare': [ERROR],
52
+ 'no-setter-return': [ERROR],
53
+ 'no-sparse-arrays': [ERROR],
54
+ 'no-template-curly-in-string': [ERROR],
55
+ 'no-this-before-super': [ERROR],
56
+ 'no-undef': [ERROR],
57
+ 'no-unexpected-multiline': [ERROR],
58
+ 'no-unmodified-loop-condition': [ERROR],
59
+ 'no-unreachable': [ERROR],
60
+ 'no-unreachable-loop': [ERROR],
61
+ 'no-unsafe-finally': [ERROR],
62
+ 'no-unsafe-negation': [ERROR],
63
+ 'no-unsafe-optional-chaining': [
64
+ ERROR,
65
+ { disallowArithmeticOperators: true },
66
+ ],
67
+ 'no-unused-private-class-members': [ERROR],
68
+ 'no-unused-vars': [WARN],
69
+ 'no-use-before-define': [
70
+ ERROR,
71
+ { classes: true, functions: false, variables: true },
72
+ ],
73
+ 'no-useless-backreference': [ERROR],
74
+ 'require-atomic-updates': [ERROR],
75
+ 'use-isnan': [ERROR],
76
+ 'valid-typeof': [
77
+ ERROR,
78
+ { requireStringLiterals: true },
79
+ ],
62
80
  };