@st1ggy/linter-config 1.0.67 → 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.67",
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,7 +1,7 @@
1
- import commonRules from './rules/rules.common.js'
2
- import importRules from './rules/rules.import.js'
3
- import prettierRules from './rules/rules.prettier.js'
4
- import sonarjsRules from './rules/rules.sonarjs.js'
5
- import unicornRules from './rules/rules.unicorn.js'
1
+ import commonConfig from './rules/rules.common.js'
2
+ import importConfig from './rules/rules.import.js'
3
+ import prettierConfig from './rules/rules.prettier.js'
4
+ import sonarjsConfig from './rules/rules.sonarjs.js'
5
+ import unicornConfig from './rules/rules.unicorn.js'
6
6
 
7
- export default [...prettierRules, ...commonRules, ...importRules, ...unicornRules, ...sonarjsRules]
7
+ export default [...prettierConfig, ...commonConfig, ...importConfig, ...unicornConfig, ...sonarjsConfig]
@@ -1,17 +1,4 @@
1
- import nextPlugin from '@next/eslint-plugin-next'
1
+ import nextConfig from './eslint.config.next.js'
2
+ import reactConfig from './eslint.config.react.js'
2
3
 
3
- import react from './eslint.config.react.js'
4
-
5
- export default [
6
- ...react,
7
- {
8
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
9
- plugins: {
10
- '@next/next': nextPlugin,
11
- },
12
- rules: {
13
- ...nextPlugin.configs.recommended.rules,
14
- ...nextPlugin.configs['core-web-vitals'].rules,
15
- },
16
- },
17
- ]
4
+ export default [...reactConfig, ...nextConfig]
@@ -1,4 +1,4 @@
1
- import typescript from './eslint.config.typescript.js'
2
- import reactRules from './rules/rules.react.js'
1
+ import typescriptConfig from './eslint.config.typescript.js'
2
+ import reactConfig from './rules/rules.react.js'
3
3
 
4
- export default [...typescript, ...reactRules]
4
+ export default [...typescriptConfig, ...reactConfig]
@@ -1,11 +1,4 @@
1
- import tseslint from 'typescript-eslint'
1
+ import commonConfig from './eslint.config.common.js'
2
+ import typescriptConfig from './rules/rules.typescript.js'
2
3
 
3
- import common from './eslint.config.common.js'
4
- import typescriptRules from './rules/rules.typescript.js'
5
-
6
- export default tseslint.config(
7
- ...common,
8
- ...tseslint.configs.recommended,
9
- ...tseslint.configs.stylistic,
10
- ...typescriptRules,
11
- )
4
+ export default [...commonConfig, ...typescriptConfig]
@@ -1,88 +1,87 @@
1
1
  import eslint from '@eslint/js'
2
+ import tseslint from 'typescript-eslint'
2
3
 
3
- export default [
4
- eslint.configs.recommended,
5
- {
6
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
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
- ],
86
- },
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
+ ],
87
86
  },
88
- ]
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
+ })
@@ -0,0 +1,13 @@
1
+ import nextPlugin from '@next/eslint-plugin-next'
2
+ import tseslint from 'typescript-eslint'
3
+
4
+ export default tseslint.config({
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
+ },
13
+ })
@@ -1,11 +1,10 @@
1
1
  import prettierConfig from 'eslint-config-prettier'
2
2
  import prettierPlugin from 'eslint-plugin-prettier'
3
+ import tseslint from 'typescript-eslint'
3
4
 
4
- export default [
5
- prettierConfig,
6
- {
7
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
8
- plugins: { prettier: prettierPlugin },
9
- rules: { 'prettier/prettier': 'error' },
10
- },
11
- ]
5
+ export default tseslint.config({
6
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
7
+ extends: [prettierConfig],
8
+ plugins: { prettier: prettierPlugin },
9
+ rules: { 'prettier/prettier': 'error' },
10
+ })
@@ -1,53 +1,51 @@
1
1
  import reactJsxRuntime from 'eslint-plugin-react/configs/jsx-runtime.js'
2
2
  import reactRecommended from 'eslint-plugin-react/configs/recommended.js'
3
3
  import reactHooksPlugin from 'eslint-plugin-react-hooks'
4
+ import tseslint from 'typescript-eslint'
4
5
 
5
- export default [
6
- reactRecommended,
7
- reactJsxRuntime,
8
- {
9
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
10
- plugins: { 'react-hooks': reactHooksPlugin },
11
- rules: {
12
- 'react/boolean-prop-naming': 'error',
13
- 'react/button-has-type': 'error',
14
- 'react/checked-requires-onchange-or-readonly': 'error',
15
- 'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: true }],
16
- 'react/destructuring-assignment': 'error',
17
- 'react/function-component-definition': [
18
- 'error',
19
- {
20
- namedComponents: 'arrow-function',
21
- unnamedComponents: 'arrow-function',
22
- },
23
- ],
24
- 'react/hook-use-state': 'error',
25
- 'react/jsx-boolean-value': 'error',
26
- 'react/jsx-closing-bracket-location': 'error',
27
- 'react/jsx-closing-tag-location': 'error',
28
- 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
29
- 'react/jsx-curly-newline': ['error', { multiline: 'consistent', singleline: 'forbid' }],
30
- 'react/jsx-curly-spacing': [
31
- 'error',
32
- {
33
- when: 'never',
34
- attributes: { allowMultiline: false },
35
- children: false,
36
- },
37
- ],
38
- 'react/jsx-equals-spacing': ['error', 'never'],
39
- 'react/jsx-first-prop-new-line': ['error', 'multiline'],
40
- 'react/jsx-fragments': 'error',
41
- 'react/jsx-handler-names': 'error',
42
- 'react/jsx-max-props-per-line': ['error', { when: 'multiline' }],
43
- 'react/jsx-no-constructed-context-values': 'error',
44
- 'react/jsx-no-leaked-render': 'error',
45
- 'react/jsx-no-useless-fragment': 'error',
46
- 'react/jsx-props-no-multi-spaces': 'error',
47
- 'react/jsx-tag-spacing': 'error',
48
- 'react/no-multi-comp': 'error',
49
- 'react/self-closing-comp': ['error', { component: true, html: true }],
50
- ...reactHooksPlugin.configs.recommended.rules,
51
- },
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,
52
50
  },
53
- ]
51
+ })
@@ -1,3 +1,7 @@
1
1
  import sonarjs from 'eslint-plugin-sonarjs'
2
+ import tseslint from 'typescript-eslint'
2
3
 
3
- export default [sonarjs.configs.recommended]
4
+ export default tseslint.config({
5
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
6
+ extends: [sonarjs.configs.recommended],
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,26 +1,25 @@
1
1
  import unicornPlugin from 'eslint-plugin-unicorn'
2
+ import tseslint from 'typescript-eslint'
2
3
 
3
- export default [
4
- unicornPlugin.configs['flat/recommended'],
5
- {
6
- files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
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,
21
- },
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,
22
21
  },
23
- ],
24
- },
22
+ },
23
+ ],
25
24
  },
26
- ]
25
+ })