@thermarthae/eslint-config 1.0.0 → 3.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,44 +1,44 @@
1
- # @thermarthae/eslint-config
2
-
3
- Just a personalized [Airbnb](https://www.npmjs.com/package/eslint-config-airbnb) Eslint config.
4
-
5
- ## ✨ Setup
6
-
7
- ### 1) Install
8
-
9
- This step assumes that you have already installed Eslint and Typescript.
10
-
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
13
- ```
14
-
15
- If you don't need React support:
16
-
17
- ```bash
18
- yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import
19
- ```
20
-
21
- ### 2) Configure ESLint
22
-
23
- Add `"extends": "@thermarthae/eslint-config"` to your ESLint config file.
24
-
25
- An example `.eslintrc.js`:
26
-
27
- ```js
28
- module.exports = {
29
- // If you don't need React support:
30
- // extends: ['@thermarthae/eslint-config/base'],
31
- extends: ['@thermarthae/eslint-config'],
32
- };
33
- ```
34
-
35
- **Note**: If your `tsconfig.json` is not in the same directory as `package.json`, you will have to set the path yourself:
36
-
37
- ```diff
38
- module.exports = {
39
- extends: ['@thermarthae/eslint-config'],
40
- + parserOptions: {
41
- + project: './foo/bar/tsconfig.json',
42
- + },
43
- };
44
- ```
1
+ # @thermarthae/eslint-config
2
+
3
+ Just an Eslint config.
4
+
5
+ ## ✨ Setup
6
+
7
+ ### 1) Install
8
+
9
+ This step assumes that you have already installed Eslint and Typescript.
10
+
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 @stylistic/eslint-plugin
13
+ ```
14
+
15
+ If you don't need React support:
16
+
17
+ ```bash
18
+ yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-simple-import-sort @stylistic/eslint-plugin
19
+ ```
20
+
21
+ ### 2) Configure ESLint
22
+
23
+ Add `"extends": "@thermarthae/eslint-config"` to your ESLint config file.
24
+
25
+ An example `.eslintrc.cjs`:
26
+
27
+ ```js
28
+ module.exports = {
29
+ // If you don't need React support:
30
+ // extends: ['@thermarthae/eslint-config/base.cjs'],
31
+ extends: ['@thermarthae/eslint-config'],
32
+ };
33
+ ```
34
+
35
+ **Note**: If your `tsconfig.json` is not in the same directory as `package.json`, you will have to set the path yourself:
36
+
37
+ ```diff
38
+ module.exports = {
39
+ extends: ['@thermarthae/eslint-config'],
40
+ + parserOptions: {
41
+ + project: './foo/bar/tsconfig.json',
42
+ + },
43
+ };
44
+ ```
package/base.cjs ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ extends: [
3
+ './shared.cjs',
4
+ ],
5
+ };
package/index.cjs ADDED
@@ -0,0 +1,55 @@
1
+ module.exports = {
2
+ extends: [
3
+ './shared.cjs',
4
+ 'plugin:react/recommended',
5
+ 'plugin:react/jsx-runtime',
6
+ 'plugin:react-hooks/recommended',
7
+ 'plugin:jsx-a11y/recommended',
8
+ ],
9
+ plugins: ['jsx-a11y'],
10
+ settings: {
11
+ react: {
12
+ version: 'detect',
13
+ },
14
+ },
15
+ rules: {
16
+ 'react/no-unknown-property': 0,
17
+ 'react/no-children-prop': 0,
18
+ 'react/prop-types': 0,
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',
54
+ },
55
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@thermarthae/eslint-config",
3
- "version": "1.0.0",
4
- "main": "index.js",
3
+ "version": "3.0.0",
4
+ "main": "index.cjs",
5
5
  "description": "Just a personal eslint config",
6
6
  "license": "MIT",
7
7
  "author": "thermarthae <thermarthae@protonmail.com>",
@@ -10,38 +10,42 @@
10
10
  "url": "git+https://github.com/thermarthae/eslint-config.git"
11
11
  },
12
12
  "files": [
13
- "base.js",
14
- "index.js",
15
- "shared.js"
13
+ "base.cjs",
14
+ "index.cjs",
15
+ "shared.cjs"
16
16
  ],
17
- "packageManager": "yarn@3.0.2",
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": "^18.2.1",
24
- "eslint-config-airbnb-base": "^14.2.1",
25
- "eslint-config-airbnb-typescript": "^14.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": "^4.30.0",
29
- "@typescript-eslint/parser": "^4.30.0",
30
- "eslint": "^7.32.0",
31
- "eslint-plugin-import": "^2.24.2",
32
- "typescript": "^4.4.2"
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-plugin-import": "^2.29.1",
31
+ "eslint-plugin-simple-import-sort": "^12.0.0",
32
+ "typescript": "^5.3.3"
33
33
  },
34
34
  "peerDependencies": {
35
- "@typescript-eslint/eslint-plugin": "^4.30.0",
36
- "@typescript-eslint/parser": "^4.30.0",
37
- "eslint": "^7.32.0",
38
- "eslint-plugin-import": "^2.24.2",
39
- "eslint-plugin-jsx-a11y": "^6.4.1",
40
- "eslint-plugin-react": "^7.25.1",
41
- "eslint-plugin-react-hooks": "^4.2.0",
42
- "typescript": "^4.4.2"
35
+ "@stylistic/eslint-plugin": "^1.6.2",
36
+ "@typescript-eslint/parser": "^6.20.0 || ^7.1.0",
37
+ "eslint": "^8.56.0",
38
+ "eslint-plugin-import": "^2.29.1",
39
+ "eslint-plugin-jsx-a11y": "^6.8.0",
40
+ "eslint-plugin-react": "^7.33.2",
41
+ "eslint-plugin-react-hooks": "^4.6.0",
42
+ "eslint-plugin-simple-import-sort": "^12.0.0",
43
+ "typescript": "^5.3.3"
43
44
  },
44
45
  "peerDependenciesMeta": {
46
+ "eslint-config-prettier": {
47
+ "optional": true
48
+ },
45
49
  "eslint-plugin-jsx-a11y": {
46
50
  "optional": true
47
51
  },
package/shared.cjs ADDED
@@ -0,0 +1,118 @@
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
+
11
+ module.exports = {
12
+ extends: [
13
+ 'eslint:recommended',
14
+ 'plugin:@typescript-eslint/recommended-type-checked',
15
+ 'plugin:@typescript-eslint/stylistic-type-checked',
16
+ 'plugin:@stylistic/disable-legacy',
17
+ ],
18
+ plugins: [
19
+ '@typescript-eslint',
20
+ 'import',
21
+ 'simple-import-sort',
22
+ '@stylistic',
23
+ ],
24
+ parser: '@typescript-eslint/parser',
25
+ parserOptions: {
26
+ project: true,
27
+ sourceType: 'module',
28
+ },
29
+ overrides: [
30
+ {
31
+ files: ['*.cjs'],
32
+ env: {
33
+ node: true,
34
+ },
35
+ },
36
+ {
37
+ files: ['*.cjs', '*.js'],
38
+ rules: {
39
+ '@typescript-eslint/ban-ts-comment': 0,
40
+ '@typescript-eslint/no-unsafe-assignment': 0,
41
+ '@typescript-eslint/no-unsafe-call': 0,
42
+ '@typescript-eslint/no-unsafe-member-access': 0,
43
+ '@typescript-eslint/no-var-requires': 0,
44
+ },
45
+ },
46
+ ],
47
+ rules: {
48
+ ...customized.rules,
49
+ '@stylistic/arrow-parens': ['error', 'as-needed', {
50
+ requireForBlockBody: true,
51
+ }],
52
+ '@stylistic/linebreak-style': ['error', 'windows'],
53
+ '@stylistic/max-len': ['error', { code: 120 }],
54
+ '@stylistic/no-multiple-empty-lines': ['error', {
55
+ max: 3,
56
+ maxBOF: 0,
57
+ maxEOF: 1,
58
+ }],
59
+ '@stylistic/max-statements-per-line': 0,
60
+ '@stylistic/indent-binary-ops': 0,
61
+ //
62
+ '@typescript-eslint/array-type': ['error', {
63
+ default: 'array-simple',
64
+ }],
65
+ '@typescript-eslint/consistent-type-assertions': ['error', {
66
+ assertionStyle: 'as',
67
+ objectLiteralTypeAssertions: 'allow-as-parameter',
68
+ }],
69
+ '@typescript-eslint/consistent-type-definitions': 0,
70
+ '@typescript-eslint/no-unused-vars': 0,
71
+ '@typescript-eslint/no-empty-function': 0,
72
+ '@typescript-eslint/no-misused-promises': ['error', {
73
+ checksVoidReturn: false,
74
+ }],
75
+ '@typescript-eslint/no-unnecessary-type-arguments': 'warn',
76
+ '@typescript-eslint/no-shadow': 'error',
77
+ '@typescript-eslint/promise-function-async': 'error',
78
+ //
79
+ 'simple-import-sort/imports': ['warn', {
80
+ groups: [
81
+ // Side effect imports.
82
+ ['^\\u0000'],
83
+ [
84
+ '^node:',
85
+ 'react',
86
+ // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
87
+ '^@?\\w',
88
+ ],
89
+ // Absolute imports and other imports such as Vue-style `@/foo`.
90
+ ['^'],
91
+ [
92
+ // ../whatever/
93
+ '^\\.\\./(?=.*/)',
94
+ // ../
95
+ '^\\.\\./',
96
+ ],
97
+ [
98
+ // ./whatever/
99
+ '^\\./(?=.*/)',
100
+ // ./
101
+ '^\\./',
102
+ ],
103
+ ],
104
+ }],
105
+ //
106
+ 'no-param-reassign': ['error', {
107
+ ignorePropertyModificationsFor: [
108
+ 'request',
109
+ 'reply',
110
+ 'session',
111
+ 'state',
112
+ ],
113
+ props: true,
114
+ }],
115
+ 'no-void': ['error', { allowAsStatement: true }],
116
+ yoda: ['error', 'never', { exceptRange: true }],
117
+ },
118
+ };
package/base.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- 'airbnb-base',
4
- 'airbnb-typescript/base',
5
- './shared.js',
6
- ],
7
- };
package/index.js DELETED
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- 'airbnb',
4
- 'airbnb-typescript',
5
- 'airbnb/hooks',
6
- './shared.js',
7
- ],
8
- overrides: [
9
- {
10
- files: '*.tsx',
11
- rules: {
12
- '@typescript-eslint/member-ordering': 0, // `react/sort-comp` is handling this out
13
- 'consistent-return': 0, // annoys inside react hooks
14
- },
15
- },
16
- ],
17
- rules: {
18
- 'react/destructuring-assignment': 0,
19
- 'react/jsx-indent': ['error', 'tab'],
20
- 'react/jsx-indent-props': ['error', 'tab'],
21
- 'react/jsx-props-no-spreading': 0,
22
- 'react/no-children-prop': 0,
23
- 'react/prop-types': 0,
24
- 'react/require-default-props': 0,
25
- 'react/state-in-constructor': ['error', 'never'],
26
- 'react/static-property-placement': ['error', 'static public field'],
27
- },
28
- };
package/shared.js DELETED
@@ -1,87 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- 'plugin:@typescript-eslint/recommended',
4
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
5
- ],
6
- parserOptions: {
7
- ecmaVersion: 2021,
8
- project: 'tsconfig.json',
9
- warnOnUnsupportedTypeScriptVersion: false,
10
- },
11
- overrides: [
12
- {
13
- files: '*.js',
14
- rules: {
15
- '@typescript-eslint/ban-ts-comment': 0,
16
- '@typescript-eslint/no-unsafe-assignment': 0,
17
- '@typescript-eslint/no-unsafe-call': 0,
18
- '@typescript-eslint/no-unsafe-member-access': 0,
19
- '@typescript-eslint/no-var-requires': 0,
20
- },
21
- },
22
- {
23
- files: '*.d.ts',
24
- rules: {
25
- 'import/prefer-default-export': 0,
26
- },
27
- },
28
- ],
29
- rules: {
30
- '@typescript-eslint/array-type': ['error', {
31
- default: 'array-simple',
32
- }],
33
- '@typescript-eslint/consistent-type-assertions': ['error', {
34
- assertionStyle: 'as',
35
- objectLiteralTypeAssertions: 'allow-as-parameter',
36
- }],
37
- '@typescript-eslint/explicit-module-boundary-types': 0,
38
- '@typescript-eslint/indent': ['error', 'tab'],
39
- '@typescript-eslint/member-delimiter-style': ['error', {
40
- multiline: {
41
- delimiter: 'semi',
42
- requireLast: true,
43
- },
44
- singleline: {
45
- delimiter: 'semi',
46
- requireLast: false,
47
- },
48
- }],
49
- '@typescript-eslint/member-ordering': 'error',
50
- '@typescript-eslint/no-explicit-any': 0,
51
- '@typescript-eslint/no-misused-promises': ['error', {
52
- checksVoidReturn: false,
53
- }],
54
- '@typescript-eslint/no-non-null-assertion': 0,
55
- '@typescript-eslint/no-unnecessary-type-arguments': 'error',
56
- '@typescript-eslint/no-unsafe-assignment': 0, // its not very performant
57
- '@typescript-eslint/prefer-optional-chain': 'error',
58
- '@typescript-eslint/promise-function-async': 'error',
59
- 'arrow-parens': ['error', 'as-needed', {
60
- requireForBlockBody: true,
61
- }],
62
- 'import/no-cycle': 0,
63
- 'import/no-named-as-default': 0, // its not very performant
64
- 'max-len': ['error', { code: 120 }],
65
- 'no-console': 0,
66
- 'no-multiple-empty-lines': ['error', {
67
- max: 3,
68
- maxBOF: 0,
69
- maxEOF: 1,
70
- }],
71
- 'no-param-reassign': ['error', {
72
- ignorePropertyModificationsFor: [
73
- 'request',
74
- 'reply',
75
- 'session',
76
- ],
77
- props: true,
78
- }],
79
- 'no-tabs': 0,
80
- 'no-void': ['error', {
81
- allowAsStatement: true,
82
- }],
83
- yoda: ['error', 'never', {
84
- exceptRange: true,
85
- }],
86
- },
87
- };