@cenk1cenk2/eslint-config 2.7.58 → 2.7.60

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/.prettierrc.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** @type {import("prettier").Config} */
2
- module.exports = {
2
+ export default {
3
3
  printWidth: 179,
4
4
  tabWidth: 2,
5
5
  useTabs: false,
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.7.60](https://gitlab.kilic.dev/config/eslint-config/compare/v2.7.59...v2.7.60) (2024-10-18)
2
+
3
+
4
+ ### Performance Improvements
5
+
6
+ * update with new methodology on eslint9 ([9b96609](https://gitlab.kilic.dev/config/eslint-config/commit/9b9660906d6a2a816e64e496e9e76a309fd3383a))
7
+
8
+ ## [2.7.59](https://gitlab.kilic.dev/config/eslint-config/compare/v2.7.58...v2.7.59) (2024-10-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency eslint-plugin-import to ^2.31.0 ([122610c](https://gitlab.kilic.dev/config/eslint-config/commit/122610c776ef5fd4c2fe18bc85a6ac930eac57f7))
14
+
1
15
  ## [2.7.58](https://gitlab.kilic.dev/config/eslint-config/compare/v2.7.57...v2.7.58) (2024-09-04)
2
16
 
3
17
 
package/base.js ADDED
@@ -0,0 +1,152 @@
1
+ import js from '@eslint/js'
2
+ import StylisticPlugin from '@stylistic/eslint-plugin'
3
+
4
+ import imports from './import.js'
5
+
6
+ /** @type {import("eslint").Linter.Config[]} */
7
+ export default [
8
+ js.configs.recommended,
9
+ ...imports,
10
+ {
11
+ languageOptions: {
12
+ globals: {
13
+ browser: true,
14
+ es6: true,
15
+ node: true
16
+ },
17
+ parserOptions: {
18
+ createDefaultProgram: true,
19
+ ecmaVersion: 'latest',
20
+ sourceType: 'module'
21
+ }
22
+ },
23
+ plugins: {
24
+ stylistic: StylisticPlugin
25
+ },
26
+ rules: {
27
+ 'stylistic/semi': ['error', 'never'],
28
+ 'stylistic/linebreak-style': ['error', 'unix'],
29
+ 'sort-imports': 'off',
30
+ 'stylistic/indent': ['error', 2],
31
+ 'stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true } ],
32
+ 'stylistic/comma-spacing': ['error', { before: false, after: true } ],
33
+ 'stylistic/func-call-spacing': ['error', 'never'],
34
+ 'stylistic/max-len': [
35
+ 'error',
36
+ {
37
+ code: 180,
38
+ comments: 180
39
+ }
40
+ ],
41
+ 'stylistic/no-multi-spaces': 'error',
42
+ 'stylistic/no-multiple-empty-lines': [
43
+ 'error',
44
+ {
45
+ max: 1
46
+ }
47
+ ],
48
+ 'stylistic/space-before-function-paren': ['error', 'never'],
49
+ 'stylistic/object-curly-newline': [
50
+ 'error',
51
+ {
52
+ ObjectExpression: {
53
+ multiline: true,
54
+ minProperties: 3,
55
+ consistent: true
56
+ },
57
+ ObjectPattern: 'never',
58
+ ImportDeclaration: {
59
+ multiline: true,
60
+ minProperties: 10
61
+ },
62
+ ExportDeclaration: {
63
+ multiline: true,
64
+ minProperties: 10
65
+ }
66
+ }
67
+ ],
68
+ 'stylistic/object-curly-spacing': ['error', 'always'],
69
+ 'stylistic/comma-dangle': ['error', 'never'],
70
+ 'stylistic/array-element-newline': ['error', 'consistent'],
71
+ 'stylistic/array-bracket-newline': ['error', 'consistent'],
72
+ 'stylistic/array-bracket-spacing': [
73
+ 'error',
74
+ 'never',
75
+ {
76
+ objectsInArrays: true,
77
+ arraysInArrays: true
78
+ }
79
+ ],
80
+ curly: ['error', 'all'],
81
+ complexity: ['error', 25],
82
+ 'dot-notation': 'error',
83
+ eqeqeq: ['error', 'smart'],
84
+ 'stylistic/quotes': ['error', 'single'],
85
+ 'stylistic/quote-props': ['error', 'as-needed'],
86
+ 'guard-for-in': 'error',
87
+ 'id-match': 'off',
88
+ 'max-classes-per-file': 'off',
89
+ 'stylistic/new-parens': 'error',
90
+ 'no-bitwise': 'error',
91
+ 'no-caller': 'error',
92
+ 'no-prototype-builtins': 'off',
93
+ 'no-console': 'warn',
94
+ 'no-debugger': 'warn',
95
+ 'no-empty': 'warn',
96
+ 'no-eval': 'error',
97
+ 'no-invalid-this': 'off',
98
+ 'no-new-wrappers': 'error',
99
+ 'no-shadow': [
100
+ 'off',
101
+ {
102
+ hoist: 'all'
103
+ }
104
+ ],
105
+ 'no-throw-literal': 'error',
106
+ 'stylistic/no-trailing-spaces': 'error',
107
+ 'no-undef-init': 'error',
108
+ 'no-underscore-dangle': 'error',
109
+ 'no-unsafe-finally': 'error',
110
+ 'no-unused-expressions': 'warn',
111
+ 'no-unused-vars': 'error',
112
+ 'object-shorthand': 'error',
113
+ 'one-var': ['error', 'never'],
114
+ 'stylistic/template-curly-spacing': ['error', 'never'],
115
+ radix: 'error',
116
+ 'stylistic/spaced-comment': 'error',
117
+ 'use-isnan': 'error',
118
+ 'valid-typeof': 'warn',
119
+ 'stylistic/arrow-parens': ['error', 'always'],
120
+ 'stylistic/keyword-spacing': 'error',
121
+ 'stylistic/lines-between-class-members': 'off',
122
+ 'stylistic/padding-line-between-statements': [
123
+ 'error',
124
+ {
125
+ blankLine: 'always',
126
+ prev: '*',
127
+ next: 'return'
128
+ },
129
+ {
130
+ blankLine: 'always',
131
+ prev: ['const', 'let', 'var'],
132
+ next: '*'
133
+ },
134
+ {
135
+ blankLine: 'any',
136
+ prev: ['const', 'let', 'var'],
137
+ next: ['const', 'let', 'var']
138
+ },
139
+ {
140
+ blankLine: 'always',
141
+ prev: ['case', 'default'],
142
+ next: '*'
143
+ },
144
+ {
145
+ blankLine: 'always',
146
+ prev: '*',
147
+ next: ['function', 'if', 'try', 'break', 'class', 'for', 'while', 'do']
148
+ }
149
+ ]
150
+ }
151
+ }
152
+ ]
package/constants.js CHANGED
@@ -1,3 +1 @@
1
- const ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS = [ '*.js', '*.cjs', '*.mjs', '*.ts', '*.tsx', '*.vue', '*.svelte' ]
2
-
3
- module.exports = { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS }
1
+ export const ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS = ['*.js', '*.cjs', '*.mjs', '*.ts', '*.tsx', '*.vue', '*.svelte']
@@ -0,0 +1,9 @@
1
+ import base from './base.js'
2
+
3
+ /** @type {import("eslint").Linter.Config[]} */
4
+ export default [
5
+ ...base,
6
+ {
7
+ files: ['**/*.js']
8
+ }
9
+ ]
package/import-strict.js CHANGED
@@ -1,15 +1,15 @@
1
- const { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS } = require('./constants')
1
+ import ImportPlugin from 'eslint-plugin-import'
2
2
 
3
- /** @type {import("eslint").Linter.Config} */
4
- module.exports = {
5
- overrides: [
6
- {
7
- files: ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS,
8
- plugins: [ 'import' ],
9
- rules: {
10
- 'import/no-extraneous-dependencies': 'error',
11
- 'import/exports-last': 'error'
12
- }
3
+ import { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS } from './constants.js'
4
+ /** @type {import("eslint").Linter.Config[]} */
5
+ export default [
6
+ {
7
+ plugins: {
8
+ import: ImportPlugin
9
+ },
10
+ rules: {
11
+ 'import/no-extraneous-dependencies': 'error',
12
+ 'import/exports-last': 'error'
13
13
  }
14
- ]
15
- }
14
+ }
15
+ ]
package/import.js CHANGED
@@ -1,50 +1,20 @@
1
- const { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS } = require('./constants')
1
+ import ImportPlugin from 'eslint-plugin-import'
2
2
 
3
- /** @type {import("eslint").Linter.Config} */
4
- module.exports = {
5
- overrides: [
6
- {
7
- files: ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS,
8
- plugins: [ 'import' ],
9
- rules: {
10
- 'sort-imports': 'off',
11
- 'import/first': 'error',
12
- 'import/newline-after-import': 'error',
13
- 'import/no-duplicates': 'error',
14
- 'import/order': [
15
- 'error',
16
- {
17
- pathGroups: [
18
- {
19
- pattern: '@{cenk1cenk2,cenk1cenk2-*}/**',
20
- group: 'index'
21
- },
22
- {
23
- pattern: '@{src,interfaces,utils,constants,commands}/**',
24
- group: 'index'
25
- },
26
- {
27
- pattern: '@{src,interfaces,utils,constants,commands}',
28
- group: 'index'
29
- }
30
- ],
31
- pathGroupsExcludedImportTypes: [ 'builtin' ],
32
- groups: [
33
- [ 'builtin', 'external' ],
34
- [ 'index', 'parent', 'sibling' ]
35
- ],
36
- 'newlines-between': 'always',
37
- alphabetize: {
38
- order: 'asc',
39
- caseInsensitive: true
40
- }
41
- }
42
- ],
43
- 'import/export': 'error',
44
- 'import/no-extraneous-dependencies': 'error',
45
- 'import/no-self-import': 'error',
46
- 'import/no-useless-path-segments': 'error'
47
- }
3
+ import { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS } from './constants.js'
4
+
5
+ /** @type {import("eslint").Linter.Config[]} */
6
+ export default [
7
+ {
8
+ plugins: { import: ImportPlugin },
9
+ rules: {
10
+ 'sort-imports': 'off',
11
+ 'import/first': 'error',
12
+ 'import/newline-after-import': 'error',
13
+ 'import/no-duplicates': 'error',
14
+ 'import/export': 'error',
15
+ 'import/no-extraneous-dependencies': 'error',
16
+ 'import/no-self-import': 'error',
17
+ 'import/no-useless-path-segments': 'error'
48
18
  }
49
- ]
50
- }
19
+ }
20
+ ]
package/jsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "NodeNext",
5
+ "checkJs": true
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/eslint-config",
3
- "version": "2.7.58",
3
+ "version": "2.7.60",
4
4
  "description": "Eslint configuration for my taste.",
5
5
  "main": "index.js",
6
6
  "repository": "git@gitlab.kilic.dev:config/eslint-config.git",
7
7
  "author": "Cenk Kilic",
8
8
  "license": "MIT",
9
+ "type": "module",
9
10
  "scripts": {
10
- "format": "prettier --loglevel warn --write ./*.js && eslint --ext .ts,.js,.tsx,.jsx --fix ./",
11
- "lint": "eslint --ext .ts,.js,.tsx,.jsx ./"
11
+ "format": "prettier --log-level warn --write ./*.js && eslint --fix",
12
+ "lint": "eslint",
13
+ "inspect": "eslint --inspect-config"
12
14
  },
13
15
  "simple-git-hooks": {
14
16
  "pre-commit": "pnpm exec lint-staged",
@@ -26,7 +28,7 @@
26
28
  "peerDependencies": {
27
29
  "@nuxtjs/eslint-config": ">= 7",
28
30
  "@nuxtjs/eslint-config-typescript": ">= 7",
29
- "eslint": ">= 8",
31
+ "eslint": ">= 9",
30
32
  "eslint-config-react": ">= 1",
31
33
  "eslint-plugin-react-hooks": ">= 4",
32
34
  "eslint-plugin-svelte": ">= 2",
@@ -53,14 +55,16 @@
53
55
  }
54
56
  },
55
57
  "dependencies": {
56
- "@typescript-eslint/eslint-plugin": "^7.18.0",
57
- "@typescript-eslint/parser": "^7.18.0",
58
- "eslint-plugin-import": "^2.30.0",
58
+ "@eslint/js": "^9.13.0",
59
+ "@stylistic/eslint-plugin": "^2.9.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.10.0",
61
+ "@typescript-eslint/parser": "^8.10.0",
62
+ "eslint-plugin-import": "^2.31.0",
59
63
  "load-tsconfig": "^0.2.5"
60
64
  },
61
65
  "devDependencies": {
62
- "@cenk1cenk2/cz-cc": "^1.7.9",
63
- "eslint": "^8.57.0",
66
+ "@cenk1cenk2/cz-cc": "^1.7.11",
67
+ "eslint": "^9.12.0",
64
68
  "lint-staged": "^15.2.10",
65
69
  "prettier": "^3.3.3",
66
70
  "simple-git-hooks": "^2.11.1"
@@ -1,18 +1,20 @@
1
- /** @type {import("eslint").Linter.Config} */
2
- module.exports = {
3
- extends: [ './typescript', './react' ],
4
- overrides: [
5
- {
6
- files: [ '*.tsx' ],
7
- plugins: [ 'react', 'react-hooks' ],
8
- rules: {
9
- '@typescript-eslint/no-unused-vars': 'off',
10
- '@typescript-eslint/explicit-function-return-type': 'off',
11
- '@typescript-eslint/no-extra-parens': 'off',
12
- '@typescript-eslint/no-floating-promises': 'off',
13
- '@typescript-eslint/return-await': 'off',
14
- '@typescript-eslint/indent': [ 'error', 2 ]
15
- }
1
+ import react from './react.js'
2
+ import typescript from './typescript.js'
3
+
4
+ /** @type {import("eslint").Linter.Config[]} */
5
+ export default [
6
+ ...typescript,
7
+ ...react,
8
+ {
9
+ files: ['*.tsx'],
10
+ plugins: ['react', 'react-hooks'],
11
+ rules: {
12
+ '@typescript-eslint/no-unused-vars': 'off',
13
+ '@typescript-eslint/explicit-function-return-type': 'off',
14
+ '@typescript-eslint/no-extra-parens': 'off',
15
+ '@typescript-eslint/no-floating-promises': 'off',
16
+ '@typescript-eslint/return-await': 'off',
17
+ '@typescript-eslint/indent': ['error', 2]
16
18
  }
17
- ]
18
- }
19
+ }
20
+ ]
package/react.js CHANGED
@@ -1,10 +1,12 @@
1
- /** @type {import("eslint").Linter.Config} */
2
- module.exports = {
3
- extends: [ './index' ],
4
- overrides: [
5
- {
6
- files: [ '*.jsx', '*.tsx' ],
7
- plugins: [ 'react', 'react-hooks' ],
1
+ import base from './base.js'
2
+
3
+ /** @type {import("eslint").Linter.Config[]} */
4
+ export default [
5
+ ...base,
6
+ {
7
+ files: ['*.jsx', '*.tsx'],
8
+ plugins: ['react', 'react-hooks'],
9
+ languageOptions: {
8
10
  parserOptions: {
9
11
  project: null,
10
12
  ecmaFeatures: {
@@ -12,55 +14,55 @@ module.exports = {
12
14
  },
13
15
  ecmaVersion: 2018,
14
16
  sourceType: 'module'
15
- },
16
- settings: {
17
- react: {
18
- version: 'detect'
19
- }
20
- },
21
- rules: {
22
- 'no-unused-vars': 'off',
23
- 'no-undef': 'off',
24
- indent: 'off',
25
- 'react/jsx-indent': [ 'error', 2 ],
26
- 'react/jsx-indent-props': [ 'error', 2 ],
27
- 'react/jsx-curly-newline': [ 'error', 'consistent' ],
28
- 'react/jsx-fragments': [ 'error', 'element' ],
29
- 'react/require-render-return': 'error',
30
- 'react/self-closing-comp': [
31
- 'error',
32
- {
33
- component: true,
34
- html: true
35
- }
36
- ],
37
- 'react/jsx-tag-spacing': [
38
- 'error',
39
- {
40
- closingSlash: 'never',
41
- beforeSelfClosing: 'always',
42
- afterOpening: 'never',
43
- beforeClosing: 'never'
44
- }
45
- ],
46
- 'react/jsx-closing-tag-location': 'error',
47
- 'react/jsx-curly-brace-presence': [ 'error', { props: 'never', children: 'never' } ],
48
- 'react/jsx-equals-spacing': [ 'error', 'never' ],
49
- 'react/jsx-first-prop-new-line': [ 'error', 'multiline' ],
50
- 'react/jsx-props-no-multi-spaces': 'error',
51
- 'react/jsx-wrap-multilines': [
52
- 'error',
53
- {
54
- declaration: 'parens-new-line',
55
- assignment: 'parens-new-line',
56
- return: 'parens-new-line',
57
- arrow: 'parens-new-line',
58
- condition: 'ignore',
59
- logical: 'ignore',
60
- prop: 'ignore'
61
- }
62
- ]
63
17
  }
18
+ },
19
+ settings: {
20
+ react: {
21
+ version: 'detect'
22
+ }
23
+ },
24
+ rules: {
25
+ 'no-unused-vars': 'off',
26
+ 'no-undef': 'off',
27
+ indent: 'off',
28
+ 'react/jsx-indent': ['error', 2],
29
+ 'react/jsx-indent-props': ['error', 2],
30
+ 'react/jsx-curly-newline': ['error', 'consistent'],
31
+ 'react/jsx-fragments': ['error', 'element'],
32
+ 'react/require-render-return': 'error',
33
+ 'react/self-closing-comp': [
34
+ 'error',
35
+ {
36
+ component: true,
37
+ html: true
38
+ }
39
+ ],
40
+ 'react/jsx-tag-spacing': [
41
+ 'error',
42
+ {
43
+ closingSlash: 'never',
44
+ beforeSelfClosing: 'always',
45
+ afterOpening: 'never',
46
+ beforeClosing: 'never'
47
+ }
48
+ ],
49
+ 'react/jsx-closing-tag-location': 'error',
50
+ 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' } ],
51
+ 'react/jsx-equals-spacing': ['error', 'never'],
52
+ 'react/jsx-first-prop-new-line': ['error', 'multiline'],
53
+ 'react/jsx-props-no-multi-spaces': 'error',
54
+ 'react/jsx-wrap-multilines': [
55
+ 'error',
56
+ {
57
+ declaration: 'parens-new-line',
58
+ assignment: 'parens-new-line',
59
+ return: 'parens-new-line',
60
+ arrow: 'parens-new-line',
61
+ condition: 'ignore',
62
+ logical: 'ignore',
63
+ prop: 'ignore'
64
+ }
65
+ ]
64
66
  }
65
- ]
66
- }
67
+ }
68
+ ]
package/release.config.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  branches: [
3
3
  'main',
4
4
  'master',
@@ -29,7 +29,7 @@ module.exports = {
29
29
  [
30
30
  '@semantic-release/git',
31
31
  {
32
- assets: [ 'CHANGELOG.md', 'README.md', 'yarn.lock', 'package.json' ]
32
+ assets: ['CHANGELOG.md', 'README.md', 'yarn.lock', 'package.json']
33
33
  }
34
34
  ],
35
35
  '@semantic-release/gitlab'
@@ -1,21 +1,26 @@
1
- /** @type {import("eslint").Linter.Config} */
2
- module.exports = {
3
- extends: [ 'plugin:svelte/recommended', './typescript-dynamic' ],
4
- parserOptions: {
5
- extraFileExtensions: [ '.svelte' ]
6
- },
7
- overrides: [
8
- {
9
- files: [ '*.svelte' ],
10
- parser: 'svelte-eslint-parser',
1
+ import svelte from 'eslint-plugin-svelte'
2
+
3
+ import typescript from './typescript-dynamic.js'
4
+
5
+ /** @type {import("eslint").Linter.Config[]} */
6
+ export default [
7
+ ...svelte.configs['flat/recommended'],
8
+ ...typescript,
9
+ {
10
+ languageOptions: {
11
11
  parserOptions: {
12
- parser: '@typescript-eslint/parser'
13
- },
14
- rules: {
15
- 'max-len': 'off',
16
- 'no-throw-literal': 'off',
17
- '@typescript-eslint/no-throw-literal': 'off'
12
+ extraFileExtensions: ['.svelte']
18
13
  }
14
+ },
15
+ files: ['*.svelte'],
16
+ parser: 'svelte-eslint-parser',
17
+ parserOptions: {
18
+ parser: '@typescript-eslint/parser'
19
+ },
20
+ rules: {
21
+ 'max-len': 'off',
22
+ 'no-throw-literal': 'off',
23
+ '@typescript-eslint/no-throw-literal': 'off'
19
24
  }
20
- ]
21
- }
25
+ }
26
+ ]
@@ -1,30 +1,32 @@
1
- /** @type {import("eslint").Linter.Config} */
2
- module.exports = {
3
- extends: [ './typescript' ],
4
- overrides: [
5
- {
6
- files: [ '*.ts', '*.tsx' ],
1
+ import typescript from './typescript.js'
2
+
3
+ /** @type {import("eslint").Linter.Config[]} */
4
+ export default [
5
+ ...typescript,
6
+ {
7
+ files: ['*.ts', '*.tsx'],
8
+ languageOptions: {
7
9
  parserOptions: {
8
10
  project: 'tsconfig.json'
9
- },
10
- rules: {
11
- '@typescript-eslint/no-floating-promises': 'error',
12
- '@typescript-eslint/return-await': [ 'error', 'never' ],
13
- '@typescript-eslint/await-thenable': 'error',
14
- 'dot-notation': 'off',
15
- '@typescript-eslint/dot-notation': [ 'error' ],
16
- 'no-throw-literal': 'off',
17
- '@typescript-eslint/no-throw-literal': [ 'error' ],
18
- '@typescript-eslint/prefer-reduce-type-parameter': 'error',
19
- '@typescript-eslint/consistent-type-imports': [
20
- 'error',
21
- {
22
- prefer: 'type-imports',
23
- disallowTypeAnnotations: true
24
- }
25
- ],
26
- '@typescript-eslint/consistent-type-exports': [ 'error', { fixMixedExportsWithInlineTypeSpecifier: false } ]
27
11
  }
12
+ },
13
+ rules: {
14
+ '@typescript-eslint/no-floating-promises': 'error',
15
+ '@typescript-eslint/return-await': ['error', 'never'],
16
+ '@typescript-eslint/await-thenable': 'error',
17
+ 'dot-notation': 'off',
18
+ '@typescript-eslint/dot-notation': ['error'],
19
+ 'no-throw-literal': 'off',
20
+ '@typescript-eslint/no-throw-literal': ['error'],
21
+ '@typescript-eslint/prefer-reduce-type-parameter': 'error',
22
+ '@typescript-eslint/consistent-type-imports': [
23
+ 'error',
24
+ {
25
+ prefer: 'type-imports',
26
+ disallowTypeAnnotations: true
27
+ }
28
+ ],
29
+ '@typescript-eslint/consistent-type-exports': ['error', { fixMixedExportsWithInlineTypeSpecifier: false } ]
28
30
  }
29
- ]
30
- }
31
+ }
32
+ ]