@st1ggy/linter-config 1.0.68 → 1.0.69

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@st1ggy/linter-config",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "description": "ESLint, Stylelint and Prettier configs for React, Vue [WIP] and Svelte [WIP]",
5
5
  "private": false,
6
6
  "main": "index.js",
@@ -1,11 +1,4 @@
1
- import tseslint from 'typescript-eslint'
2
-
3
1
  import commonConfig from './eslint.config.common.js'
4
2
  import typescriptConfig from './rules/rules.typescript.js'
5
3
 
6
- export default tseslint.config(
7
- ...commonConfig,
8
- ...tseslint.configs.recommended,
9
- ...tseslint.configs.stylistic,
10
- ...typescriptConfig,
11
- )
4
+ export default [...commonConfig, ...typescriptConfig]
@@ -1,92 +1,87 @@
1
1
  import eslint from '@eslint/js'
2
2
  import tseslint from 'typescript-eslint'
3
3
 
4
- export default tseslint.config(
5
- {
6
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
7
- extends: eslint.configs.recommended,
4
+ export default tseslint.config({
5
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
6
+ extends: [eslint.configs.recommended],
7
+ rules: {
8
+ 'no-console': 'warn',
9
+ 'no-debugger': 'warn',
10
+ 'object-curly-newline': 'off',
11
+ 'operator-linebreak': 'off',
12
+ 'function-paren-newline': 'off',
13
+ 'no-confusing-arrow': 'off',
14
+ 'newline-per-chained-call': 'off',
15
+ indent: 'off',
16
+ 'implicit-arrow-linebreak': 'off',
17
+ 'no-undef': 'off',
18
+ 'lines-between-class-members': [
19
+ 'error',
20
+ 'always',
21
+ {
22
+ exceptAfterSingleLine: true,
23
+ },
24
+ ],
25
+ 'prefer-template': 'error',
26
+ 'arrow-body-style': ['error', 'as-needed'],
27
+ 'no-return-assign': 'off',
28
+ 'newline-before-return': ['error'],
29
+ radix: 'off',
30
+ 'no-mixed-operators': 'off',
31
+ 'max-len': [
32
+ 'error',
33
+ {
34
+ code: 120,
35
+ tabWidth: 2,
36
+ ignoreComments: true,
37
+ ignoreRegExpLiterals: true,
38
+ ignoreStrings: true,
39
+ ignoreTrailingComments: true,
40
+ },
41
+ ],
42
+ camelcase: [
43
+ 'error',
44
+ {
45
+ allow: ['Open_Sans'],
46
+ },
47
+ ],
48
+ 'no-shadow': 'off',
49
+ 'no-unused-vars': 'off',
50
+ 'no-use-before-define': 'off',
51
+ 'sort-imports': [
52
+ 'error',
53
+ {
54
+ ignoreDeclarationSort: true,
55
+ },
56
+ ],
57
+ quotes: ['error', 'single', { avoidEscape: true }],
58
+ 'object-shorthand': 'error',
59
+ 'prefer-const': 'error',
60
+ 'class-methods-use-this': 'off',
61
+ 'spaced-comment': ['error', 'always'],
62
+ 'no-restricted-syntax': [
63
+ 'error',
64
+ {
65
+ selector: 'WithStatement',
66
+ message: '`with` statement are not allowed.',
67
+ },
68
+ {
69
+ selector: 'ForInStatement',
70
+ message: 'Use for..of instead.',
71
+ },
72
+ {
73
+ selector: 'TSEnumDeclaration',
74
+ message: "Don't declare enums, use type union of literal strings or constants.",
75
+ },
76
+ {
77
+ selector: 'MemberExpression[object.name="React"]',
78
+ message: 'Use named imports from react.',
79
+ },
80
+ {
81
+ selector:
82
+ 'CallExpression[callee.property.name="replaceAll"] > Literal[regex.flags=/^[^g]*$/].arguments:first-child',
83
+ message: 'Missing "g" flag in regular expression.',
84
+ },
85
+ ],
8
86
  },
9
- {
10
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
11
- rules: {
12
- 'no-console': 'warn',
13
- 'no-debugger': 'warn',
14
- 'object-curly-newline': 'off',
15
- 'operator-linebreak': 'off',
16
- 'function-paren-newline': 'off',
17
- 'no-confusing-arrow': 'off',
18
- 'newline-per-chained-call': 'off',
19
- indent: 'off',
20
- 'implicit-arrow-linebreak': 'off',
21
- 'no-undef': 'off',
22
- 'lines-between-class-members': [
23
- 'error',
24
- 'always',
25
- {
26
- exceptAfterSingleLine: true,
27
- },
28
- ],
29
- 'prefer-template': 'error',
30
- 'arrow-body-style': ['error', 'as-needed'],
31
- 'no-return-assign': 'off',
32
- 'newline-before-return': ['error'],
33
- radix: 'off',
34
- 'no-mixed-operators': 'off',
35
- 'max-len': [
36
- 'error',
37
- {
38
- code: 120,
39
- tabWidth: 2,
40
- ignoreComments: true,
41
- ignoreRegExpLiterals: true,
42
- ignoreStrings: true,
43
- ignoreTrailingComments: true,
44
- },
45
- ],
46
- camelcase: [
47
- 'error',
48
- {
49
- allow: ['Open_Sans'],
50
- },
51
- ],
52
- 'no-shadow': 'off',
53
- 'no-unused-vars': 'off',
54
- 'no-use-before-define': 'off',
55
- 'sort-imports': [
56
- 'error',
57
- {
58
- ignoreDeclarationSort: true,
59
- },
60
- ],
61
- quotes: ['error', 'single', { avoidEscape: true }],
62
- 'object-shorthand': 'error',
63
- 'prefer-const': 'error',
64
- 'class-methods-use-this': 'off',
65
- 'spaced-comment': ['error', 'always'],
66
- 'no-restricted-syntax': [
67
- 'error',
68
- {
69
- selector: 'WithStatement',
70
- message: '`with` statement are not allowed.',
71
- },
72
- {
73
- selector: 'ForInStatement',
74
- message: 'Use for..of instead.',
75
- },
76
- {
77
- selector: 'TSEnumDeclaration',
78
- message: "Don't declare enums, use type union of literal strings or constants.",
79
- },
80
- {
81
- selector: 'MemberExpression[object.name="React"]',
82
- message: 'Use named imports from react.',
83
- },
84
- {
85
- selector:
86
- 'CallExpression[callee.property.name="replaceAll"] > Literal[regex.flags=/^[^g]*$/].arguments:first-child',
87
- message: 'Missing "g" flag in regular expression.',
88
- },
89
- ],
90
- },
91
- },
92
- )
87
+ })
@@ -1,45 +1,44 @@
1
1
  import importPlugin from 'eslint-plugin-import'
2
+ import tseslint from 'typescript-eslint'
2
3
 
3
- export default [
4
- {
5
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
6
- plugins: { import: importPlugin },
7
- rules: {
8
- 'import/newline-after-import': 'error',
9
- 'import/order': [
10
- 'error',
11
- {
12
- 'newlines-between': 'always',
13
- groups: [['builtin', 'external'], ['internal'], ['sibling', 'parent', 'index', 'object'], ['type']],
14
- pathGroups: [
15
- {
16
- pattern: '@/**',
17
- group: 'external',
18
- position: 'after',
19
- },
20
- ],
21
- alphabetize: {
22
- order: 'asc',
23
- caseInsensitive: false,
4
+ export default tseslint.config({
5
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
6
+ plugins: { import: importPlugin },
7
+ rules: {
8
+ 'import/newline-after-import': 'error',
9
+ 'import/order': [
10
+ 'error',
11
+ {
12
+ 'newlines-between': 'always',
13
+ groups: [['builtin', 'external'], ['internal'], ['sibling', 'parent', 'index', 'object'], ['type']],
14
+ pathGroups: [
15
+ {
16
+ pattern: '@/**',
17
+ group: 'external',
18
+ position: 'after',
24
19
  },
20
+ ],
21
+ alphabetize: {
22
+ order: 'asc',
23
+ caseInsensitive: false,
25
24
  },
26
- ],
27
- 'import/no-duplicates': [
28
- 'error',
29
- {
30
- considerQueryString: true,
31
- },
32
- ],
33
- 'import/prefer-default-export': 'off',
34
- 'import/extensions': [
35
- 'error',
36
- 'never',
37
- {
38
- js: 'never',
39
- json: 'ignorePackages',
40
- },
41
- ],
42
- 'import/no-unresolved': ['error', {}],
43
- },
25
+ },
26
+ ],
27
+ 'import/no-duplicates': [
28
+ 'error',
29
+ {
30
+ considerQueryString: true,
31
+ },
32
+ ],
33
+ 'import/prefer-default-export': 'off',
34
+ 'import/extensions': [
35
+ 'error',
36
+ 'never',
37
+ {
38
+ js: 'never',
39
+ json: 'ignorePackages',
40
+ },
41
+ ],
42
+ 'import/no-unresolved': ['error', {}],
44
43
  },
45
- ]
44
+ })
@@ -1,14 +1,13 @@
1
1
  import nextPlugin from '@next/eslint-plugin-next'
2
+ import tseslint from 'typescript-eslint'
2
3
 
3
- export default [
4
- {
5
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
6
- plugins: {
7
- '@next/next': nextPlugin,
8
- },
9
- rules: {
10
- ...nextPlugin.configs.recommended.rules,
11
- ...nextPlugin.configs['core-web-vitals'].rules,
12
- },
4
+ export default tseslint.config({
5
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
6
+ plugins: {
7
+ '@next/next': nextPlugin,
13
8
  },
14
- ]
9
+ rules: {
10
+ ...nextPlugin.configs.recommended.rules,
11
+ ...nextPlugin.configs['core-web-vitals'].rules,
12
+ },
13
+ })
@@ -2,14 +2,9 @@ import prettierConfig from 'eslint-config-prettier'
2
2
  import prettierPlugin from 'eslint-plugin-prettier'
3
3
  import tseslint from 'typescript-eslint'
4
4
 
5
- export default tseslint.config(
6
- {
7
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
8
- extends: prettierConfig,
9
- },
10
- {
11
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
12
- plugins: { prettier: prettierPlugin },
13
- rules: { 'prettier/prettier': 'error' },
14
- },
15
- )
5
+ export default tseslint.config({
6
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
7
+ extends: [prettierConfig],
8
+ plugins: { prettier: prettierPlugin },
9
+ rules: { 'prettier/prettier': 'error' },
10
+ })
@@ -3,58 +3,49 @@ import reactRecommended from 'eslint-plugin-react/configs/recommended.js'
3
3
  import reactHooksPlugin from 'eslint-plugin-react-hooks'
4
4
  import tseslint from 'typescript-eslint'
5
5
 
6
- export default tseslint.config(
7
- {
8
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
9
- extends: reactRecommended,
6
+ export default tseslint.config({
7
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
8
+ plugins: { 'react-hooks': reactHooksPlugin },
9
+ extends: [reactRecommended, reactJsxRuntime],
10
+ rules: {
11
+ 'react/boolean-prop-naming': 'error',
12
+ 'react/button-has-type': 'error',
13
+ 'react/checked-requires-onchange-or-readonly': 'error',
14
+ 'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: true }],
15
+ 'react/destructuring-assignment': 'error',
16
+ 'react/function-component-definition': [
17
+ 'error',
18
+ {
19
+ namedComponents: 'arrow-function',
20
+ unnamedComponents: 'arrow-function',
21
+ },
22
+ ],
23
+ 'react/hook-use-state': 'error',
24
+ 'react/jsx-boolean-value': 'error',
25
+ 'react/jsx-closing-bracket-location': 'error',
26
+ 'react/jsx-closing-tag-location': 'error',
27
+ 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
28
+ 'react/jsx-curly-newline': ['error', { multiline: 'consistent', singleline: 'forbid' }],
29
+ 'react/jsx-curly-spacing': [
30
+ 'error',
31
+ {
32
+ when: 'never',
33
+ attributes: { allowMultiline: false },
34
+ children: false,
35
+ },
36
+ ],
37
+ 'react/jsx-equals-spacing': ['error', 'never'],
38
+ 'react/jsx-first-prop-new-line': ['error', 'multiline'],
39
+ 'react/jsx-fragments': 'error',
40
+ 'react/jsx-handler-names': 'error',
41
+ 'react/jsx-max-props-per-line': ['error', { when: 'multiline' }],
42
+ 'react/jsx-no-constructed-context-values': 'error',
43
+ 'react/jsx-no-leaked-render': 'error',
44
+ 'react/jsx-no-useless-fragment': 'error',
45
+ 'react/jsx-props-no-multi-spaces': 'error',
46
+ 'react/jsx-tag-spacing': 'error',
47
+ 'react/no-multi-comp': 'error',
48
+ 'react/self-closing-comp': ['error', { component: true, html: true }],
49
+ ...reactHooksPlugin.configs.recommended.rules,
10
50
  },
11
- {
12
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
13
- extends: reactJsxRuntime,
14
- },
15
- {
16
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
17
- plugins: { 'react-hooks': reactHooksPlugin },
18
- rules: {
19
- 'react/boolean-prop-naming': 'error',
20
- 'react/button-has-type': 'error',
21
- 'react/checked-requires-onchange-or-readonly': 'error',
22
- 'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: true }],
23
- 'react/destructuring-assignment': 'error',
24
- 'react/function-component-definition': [
25
- 'error',
26
- {
27
- namedComponents: 'arrow-function',
28
- unnamedComponents: 'arrow-function',
29
- },
30
- ],
31
- 'react/hook-use-state': 'error',
32
- 'react/jsx-boolean-value': 'error',
33
- 'react/jsx-closing-bracket-location': 'error',
34
- 'react/jsx-closing-tag-location': 'error',
35
- 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
36
- 'react/jsx-curly-newline': ['error', { multiline: 'consistent', singleline: 'forbid' }],
37
- 'react/jsx-curly-spacing': [
38
- 'error',
39
- {
40
- when: 'never',
41
- attributes: { allowMultiline: false },
42
- children: false,
43
- },
44
- ],
45
- 'react/jsx-equals-spacing': ['error', 'never'],
46
- 'react/jsx-first-prop-new-line': ['error', 'multiline'],
47
- 'react/jsx-fragments': 'error',
48
- 'react/jsx-handler-names': 'error',
49
- 'react/jsx-max-props-per-line': ['error', { when: 'multiline' }],
50
- 'react/jsx-no-constructed-context-values': 'error',
51
- 'react/jsx-no-leaked-render': 'error',
52
- 'react/jsx-no-useless-fragment': 'error',
53
- 'react/jsx-props-no-multi-spaces': 'error',
54
- 'react/jsx-tag-spacing': 'error',
55
- 'react/no-multi-comp': 'error',
56
- 'react/self-closing-comp': ['error', { component: true, html: true }],
57
- ...reactHooksPlugin.configs.recommended.rules,
58
- },
59
- },
60
- )
51
+ })
@@ -3,5 +3,5 @@ import tseslint from 'typescript-eslint'
3
3
 
4
4
  export default tseslint.config({
5
5
  files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
6
- extends: sonarjs.configs.recommended,
6
+ extends: [sonarjs.configs.recommended],
7
7
  })
@@ -1,28 +1,29 @@
1
- export default [
2
- {
3
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
4
- languageOptions: {
5
- parserOptions: {
6
- project: ['tsconfig.json'],
7
- },
8
- },
9
- settings: {
10
- 'import/resolver': {
11
- typescript: {},
12
- },
1
+ import tseslint from 'typescript-eslint'
2
+
3
+ export default tseslint.config({
4
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
5
+ extends: [...tseslint.configs.recommended, ...tseslint.configs.stylistic],
6
+ languageOptions: {
7
+ parserOptions: {
8
+ project: ['tsconfig.json'],
13
9
  },
14
- rules: {
15
- '@typescript-eslint/no-shadow': ['error', { ignoreTypeValueShadow: true }],
16
- '@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
17
- '@typescript-eslint/ban-ts-comment': [
18
- 'error',
19
- {
20
- 'ts-expect-error': 'allow-with-description',
21
- 'ts-ignore': 'allow-with-description',
22
- },
23
- ],
24
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
25
- '@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
10
+ },
11
+ settings: {
12
+ 'import/resolver': {
13
+ typescript: {},
26
14
  },
27
15
  },
28
- ]
16
+ rules: {
17
+ '@typescript-eslint/no-shadow': ['error', { ignoreTypeValueShadow: true }],
18
+ '@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
19
+ '@typescript-eslint/ban-ts-comment': [
20
+ 'error',
21
+ {
22
+ 'ts-expect-error': 'allow-with-description',
23
+ 'ts-ignore': 'allow-with-description',
24
+ },
25
+ ],
26
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
27
+ '@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
28
+ },
29
+ })
@@ -1,30 +1,25 @@
1
1
  import unicornPlugin from 'eslint-plugin-unicorn'
2
2
  import tseslint from 'typescript-eslint'
3
3
 
4
- export default tseslint.config(
5
- {
6
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
7
- extends: unicornPlugin.configs['flat/recommended'],
8
- },
9
- {
10
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
11
- rules: {
12
- 'unicorn/consistent-destructuring': 'error',
13
- 'unicorn/custom-error-definition': 'error',
14
- 'unicorn/no-unused-properties': 'error',
15
- 'unicorn/prevent-abbreviations': [
16
- 'error',
17
- {
18
- checkShorthandImports: false,
19
- replacements: {
20
- dev: false,
21
- prod: false,
22
- props: false,
23
- ref: false,
24
- refs: false,
25
- },
4
+ export default tseslint.config({
5
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
6
+ extends: [unicornPlugin.configs['flat/recommended']],
7
+ rules: {
8
+ 'unicorn/consistent-destructuring': 'error',
9
+ 'unicorn/custom-error-definition': 'error',
10
+ 'unicorn/no-unused-properties': 'error',
11
+ 'unicorn/prevent-abbreviations': [
12
+ 'error',
13
+ {
14
+ checkShorthandImports: false,
15
+ replacements: {
16
+ dev: false,
17
+ prod: false,
18
+ props: false,
19
+ ref: false,
20
+ refs: false,
26
21
  },
27
- ],
28
- },
22
+ },
23
+ ],
29
24
  },
30
- )
25
+ })