@thermarthae/eslint-config 2.0.0 → 4.0.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @thermarthae/eslint-config
2
2
 
3
- Just a personalized [Airbnb](https://www.npmjs.com/package/eslint-config-airbnb) Eslint config.
3
+ Just an Eslint config.
4
4
 
5
5
  ## ✨ Setup
6
6
 
@@ -9,13 +9,13 @@ Just a personalized [Airbnb](https://www.npmjs.com/package/eslint-config-airbnb)
9
9
  This step assumes that you have already installed Eslint and Typescript.
10
10
 
11
11
  ```bash
12
- yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-simple-import-sort
12
+ yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import@npm:eslint-plugin-i@latest eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-simple-import-sort @stylistic/eslint-plugin
13
13
  ```
14
14
 
15
15
  If you don't need React support:
16
16
 
17
17
  ```bash
18
- yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-simple-import-sort
18
+ yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import@npm:eslint-plugin-i@latest eslint-plugin-simple-import-sort @stylistic/eslint-plugin
19
19
  ```
20
20
 
21
21
  ### 2) Configure ESLint
@@ -27,7 +27,7 @@ An example `.eslintrc.cjs`:
27
27
  ```js
28
28
  module.exports = {
29
29
  // If you don't need React support:
30
- // extends: ['@thermarthae/eslint-config/base'],
30
+ // extends: ['@thermarthae/eslint-config/base.cjs'],
31
31
  extends: ['@thermarthae/eslint-config'],
32
32
  };
33
33
  ```
package/base.cjs CHANGED
@@ -1,7 +1,5 @@
1
1
  module.exports = {
2
2
  extends: [
3
- 'airbnb-base',
4
- 'airbnb-typescript/base',
5
3
  './shared.cjs',
6
4
  ],
7
5
  };
package/index.cjs CHANGED
@@ -1,30 +1,55 @@
1
1
  module.exports = {
2
2
  extends: [
3
- 'airbnb',
4
- 'airbnb-typescript',
5
- 'airbnb/hooks',
6
- 'plugin:react/jsx-runtime',
7
3
  './shared.cjs',
4
+ 'plugin:react/recommended',
5
+ 'plugin:react/jsx-runtime',
6
+ 'plugin:react-hooks/recommended',
7
+ 'plugin:jsx-a11y/recommended',
8
8
  ],
9
- overrides: [
10
- {
11
- files: '*.tsx',
12
- rules: {
13
- '@typescript-eslint/member-ordering': 0, // `react/sort-comp` is handling this out
14
- 'consistent-return': 0, // annoys inside react hooks
15
- },
9
+ plugins: ['jsx-a11y'],
10
+ settings: {
11
+ react: {
12
+ version: 'detect',
16
13
  },
17
- ],
14
+ },
18
15
  rules: {
19
- 'react/destructuring-assignment': 0,
20
- 'react/function-component-definition': 0,
21
- 'react/jsx-indent': ['error', 'tab'],
22
- 'react/jsx-indent-props': ['error', 'tab'],
23
- 'react/jsx-props-no-spreading': 0,
16
+ 'react/no-unknown-property': 0,
24
17
  'react/no-children-prop': 0,
25
18
  'react/prop-types': 0,
26
- 'react/require-default-props': 0,
27
- 'react/state-in-constructor': ['error', 'never'],
28
- 'react/static-property-placement': ['error', 'static public field'],
19
+ 'react/jsx-boolean-value': ['error', 'never', { always: [] }],
20
+ 'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
21
+ 'react/jsx-closing-tag-location': 'error',
22
+ 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
23
+ 'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
24
+ 'react/self-closing-comp': 'error',
25
+ 'react/jsx-wrap-multilines': ['error', {
26
+ declaration: 'parens-new-line',
27
+ assignment: 'parens-new-line',
28
+ return: 'parens-new-line',
29
+ arrow: 'parens-new-line',
30
+ condition: 'parens-new-line',
31
+ logical: 'parens-new-line',
32
+ prop: 'parens-new-line',
33
+ }],
34
+ 'react/jsx-first-prop-new-line': 'error',
35
+ 'react/jsx-tag-spacing': ['error', {
36
+ closingSlash: 'never',
37
+ beforeSelfClosing: 'always',
38
+ afterOpening: 'never',
39
+ beforeClosing: 'never',
40
+ }],
41
+ 'react/void-dom-elements-no-children': 'error',
42
+ 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never', propElementValues: 'always' }],
43
+ 'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
44
+ 'react/button-has-type': ['error', {
45
+ button: true,
46
+ submit: true,
47
+ reset: false,
48
+ }],
49
+ 'react/jsx-props-no-multi-spaces': 'error',
50
+ 'react/jsx-curly-newline': 'error',
51
+ 'react/jsx-no-useless-fragment': 'error',
52
+ 'react/jsx-no-constructed-context-values': 'error',
53
+ 'react/no-unstable-nested-components': 'error',
29
54
  },
30
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thermarthae/eslint-config",
3
- "version": "2.0.0",
3
+ "version": "4.0.0",
4
4
  "main": "index.cjs",
5
5
  "description": "Just a personal eslint config",
6
6
  "license": "MIT",
@@ -14,34 +14,35 @@
14
14
  "index.cjs",
15
15
  "shared.cjs"
16
16
  ],
17
- "packageManager": "yarn@3.4.1",
17
+ "packageManager": "yarn@4.1.0+sha256.81a00df816059803e6b5148acf03ce313cad36b7f6e5af6efa040a15981a6ffb",
18
18
  "scripts": {
19
- "update": "yarn set version latest",
20
19
  "pnpify": "yarn dlx @yarnpkg/sdks vscode"
21
20
  },
22
- "dependencies": {
23
- "eslint-config-airbnb": "^19.0.4",
24
- "eslint-config-airbnb-base": "^15.0.0",
25
- "eslint-config-airbnb-typescript": "^17.0.0"
21
+ "resolutions": {
22
+ "@stylistic/eslint-plugin-plus/@typescript-eslint/utils": "^7.1.0",
23
+ "@stylistic/eslint-plugin-ts/@typescript-eslint/utils": "^7.1.0"
26
24
  },
27
25
  "devDependencies": {
28
- "@typescript-eslint/eslint-plugin": "^5.55.0",
29
- "@typescript-eslint/parser": "^5.55.0",
30
- "eslint": "^8.36.0",
31
- "eslint-plugin-import": "^2.27.5",
32
- "eslint-plugin-simple-import-sort": "^10.0.0",
33
- "typescript": "^4.9.5"
26
+ "@stylistic/eslint-plugin": "^1.6.2",
27
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
28
+ "@typescript-eslint/parser": "^7.1.0",
29
+ "eslint": "^8.57.0",
30
+ "eslint-import-resolver-typescript": "^3.6.1",
31
+ "eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
32
+ "eslint-plugin-simple-import-sort": "^12.0.0",
33
+ "typescript": "^5.3.3"
34
34
  },
35
35
  "peerDependencies": {
36
- "@typescript-eslint/eslint-plugin": "^5.55.0",
37
- "@typescript-eslint/parser": "^5.55.0",
38
- "eslint": "^8.36.0",
39
- "eslint-plugin-import": "^2.27.5",
40
- "eslint-plugin-jsx-a11y": "^6.7.1",
41
- "eslint-plugin-react": "^7.32.2",
36
+ "@stylistic/eslint-plugin": "^1.6.2",
37
+ "@typescript-eslint/parser": "^6.20.0 || ^7.1.0",
38
+ "eslint": "^8.56.0",
39
+ "eslint-import-resolver-typescript": "^3.6.1",
40
+ "eslint-plugin-import": "^2.29.1",
41
+ "eslint-plugin-jsx-a11y": "^6.8.0",
42
+ "eslint-plugin-react": "^7.33.2",
42
43
  "eslint-plugin-react-hooks": "^4.6.0",
43
- "eslint-plugin-simple-import-sort": "^10.0.0",
44
- "typescript": "^4.9.5 || ^5.0.0"
44
+ "eslint-plugin-simple-import-sort": "^12.0.0",
45
+ "typescript": "^5.3.3"
45
46
  },
46
47
  "peerDependenciesMeta": {
47
48
  "eslint-config-prettier": {
@@ -55,9 +56,6 @@
55
56
  },
56
57
  "eslint-plugin-react-hooks": {
57
58
  "optional": true
58
- },
59
- "eslint-plugin-simple-import-sort": {
60
- "optional": true
61
59
  }
62
60
  }
63
61
  }
package/shared.cjs CHANGED
@@ -1,15 +1,46 @@
1
+ const stylistic = require('@stylistic/eslint-plugin');
2
+
3
+ const customized = stylistic.configs.customize({
4
+ indent: 'tab',
5
+ semi: true,
6
+ jsx: false,
7
+ braceStyle: '1tbs',
8
+ quoteProps: 'as-needed',
9
+ });
10
+
1
11
  module.exports = {
2
12
  extends: [
3
- 'plugin:@typescript-eslint/recommended',
4
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
13
+ 'eslint:recommended',
14
+ 'plugin:@typescript-eslint/recommended-type-checked',
15
+ 'plugin:@typescript-eslint/stylistic-type-checked',
16
+ 'plugin:@stylistic/disable-legacy',
17
+ 'plugin:import/recommended',
18
+ 'plugin:import/typescript',
5
19
  ],
6
- plugins: ['simple-import-sort'],
20
+ plugins: [
21
+ '@typescript-eslint',
22
+ 'simple-import-sort',
23
+ '@stylistic',
24
+ ],
25
+ parser: '@typescript-eslint/parser',
7
26
  parserOptions: {
27
+ project: true,
28
+ sourceType: 'module',
8
29
  ecmaVersion: 'latest',
9
- project: 'tsconfig.json',
10
- warnOnUnsupportedTypeScriptVersion: false,
30
+ },
31
+ settings: {
32
+ 'import/external-module-folders': ['.yarn', 'node_modules', 'node_modules/@types'],
33
+ 'import/resolver': {
34
+ typescript: true,
35
+ },
11
36
  },
12
37
  overrides: [
38
+ {
39
+ files: ['*.cjs'],
40
+ env: {
41
+ node: true,
42
+ },
43
+ },
13
44
  {
14
45
  files: ['*.cjs', '*.js'],
15
46
  rules: {
@@ -20,14 +51,22 @@ module.exports = {
20
51
  '@typescript-eslint/no-var-requires': 0,
21
52
  },
22
53
  },
23
- {
24
- files: '*.d.ts',
25
- rules: {
26
- 'import/prefer-default-export': 0,
27
- },
28
- },
29
54
  ],
30
55
  rules: {
56
+ ...customized.rules,
57
+ '@stylistic/arrow-parens': ['error', 'as-needed', {
58
+ requireForBlockBody: true,
59
+ }],
60
+ '@stylistic/linebreak-style': ['error', 'windows'],
61
+ '@stylistic/max-len': ['error', { code: 120 }],
62
+ '@stylistic/no-multiple-empty-lines': ['error', {
63
+ max: 3,
64
+ maxBOF: 0,
65
+ maxEOF: 1,
66
+ }],
67
+ '@stylistic/max-statements-per-line': 0,
68
+ '@stylistic/indent-binary-ops': 0,
69
+ //
31
70
  '@typescript-eslint/array-type': ['error', {
32
71
  default: 'array-simple',
33
72
  }],
@@ -35,63 +74,16 @@ module.exports = {
35
74
  assertionStyle: 'as',
36
75
  objectLiteralTypeAssertions: 'allow-as-parameter',
37
76
  }],
38
- '@typescript-eslint/explicit-module-boundary-types': 0,
39
- '@typescript-eslint/indent': ['error', 'tab'],
40
- '@typescript-eslint/member-delimiter-style': ['error', {
41
- multiline: {
42
- delimiter: 'semi',
43
- requireLast: true,
44
- },
45
- singleline: {
46
- delimiter: 'semi',
47
- requireLast: false,
48
- },
49
- }],
50
- '@typescript-eslint/member-ordering': 'error',
51
- '@typescript-eslint/no-explicit-any': 0,
77
+ '@typescript-eslint/consistent-type-definitions': 0,
78
+ '@typescript-eslint/no-unused-vars': 0,
79
+ '@typescript-eslint/no-empty-function': 0,
52
80
  '@typescript-eslint/no-misused-promises': ['error', {
53
81
  checksVoidReturn: false,
54
82
  }],
55
- '@typescript-eslint/no-non-null-assertion': 0,
56
- '@typescript-eslint/no-unnecessary-type-arguments': 'error',
57
- '@typescript-eslint/no-unsafe-assignment': 0, // its not very performant
58
- '@typescript-eslint/prefer-optional-chain': 'error',
83
+ '@typescript-eslint/no-unnecessary-type-arguments': 'warn',
84
+ '@typescript-eslint/no-shadow': 'error',
59
85
  '@typescript-eslint/promise-function-async': 'error',
60
- 'arrow-parens': ['error', 'as-needed', {
61
- requireForBlockBody: true,
62
- }],
63
- 'import/no-cycle': 0,
64
- 'import/no-named-as-default': 0, // its not very performant
65
- 'linebreak-style': ['error', 'windows'],
66
- 'max-len': ['error', { code: 120 }],
67
- 'no-console': 0,
68
- 'no-multiple-empty-lines': ['error', {
69
- max: 3,
70
- maxBOF: 0,
71
- maxEOF: 1,
72
- }],
73
- 'no-param-reassign': ['error', {
74
- ignorePropertyModificationsFor: [
75
- 'request',
76
- 'reply',
77
- 'session',
78
- ],
79
- props: true,
80
- }],
81
- 'no-restricted-exports': 0,
82
- 'no-restricted-syntax': [
83
- 'error',
84
- {
85
- selector: 'ForInStatement',
86
- message: 'for..in loops iterate over the entire prototype chain,'
87
- + ' which is virtually never what you want. Use Object.{keys,values,entries},'
88
- + ' and iterate over the resulting array.',
89
- },
90
- ],
91
- 'no-tabs': 0,
92
- 'no-void': ['error', {
93
- allowAsStatement: true,
94
- }],
86
+ //
95
87
  'simple-import-sort/imports': ['warn', {
96
88
  groups: [
97
89
  // Side effect imports.
@@ -118,8 +110,17 @@ module.exports = {
118
110
  ],
119
111
  ],
120
112
  }],
121
- yoda: ['error', 'never', {
122
- exceptRange: true,
113
+ //
114
+ 'no-param-reassign': ['error', {
115
+ ignorePropertyModificationsFor: [
116
+ 'request',
117
+ 'reply',
118
+ 'session',
119
+ 'state',
120
+ ],
121
+ props: true,
123
122
  }],
123
+ 'no-void': ['error', { allowAsStatement: true }],
124
+ yoda: ['error', 'never', { exceptRange: true }],
124
125
  },
125
126
  };