@bitfactory/eslint-config 3.3.1 → 4.1.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,9 +1,11 @@
1
1
  # @bitfactory/eslint-config
2
2
 
3
- [![Release](https://img.shields.io/badge/Release-3.x.x-F0ec73)](https://github.com/bitfactory-nl/shared-npm-eslint-config-bitfactory)
3
+ [![Release](https://img.shields.io/badge/Release-4.x.x-F0ec73)](https://github.com/bitfactory-nl/shared-npm-eslint-config-bitfactory)
4
4
  [![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
5
- ![ESLint](https://img.shields.io/badge/ESLint-^8.56|^9.0-4B3263?logo=eslint&logoColor=white)
5
+ [![ESLint](https://img.shields.io/badge/ESLint-^8.56|^9.0-4B3263?logo=eslint&logoColor=white)](https://eslint.org/)
6
6
  [![NodeJS](https://img.shields.io/badge/Node.js-^18.18|^20.9|^22.11-6da55f?logo=node.js)](https://nodejs.org/)
7
+ [![Node.js Package](https://github.com/bitfactory-nl/shared-npm-eslint-config-bitfactory/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/bitfactory-nl/shared-npm-eslint-config-bitfactory/actions/workflows/npm-publish.yml)
8
+ [![NPM package version](https://badgen.net/npm/v/@bitfactory/eslint-config)](https://npmjs.com/package/@bitfactory/eslint-config)
7
9
 
8
10
  This is a shareable config for [ESLint](https://eslint.org). All the rules and configurations are already set. Rules can be overridden if needed.
9
11
 
@@ -87,15 +89,10 @@ module.exports = {
87
89
  };
88
90
  ```
89
91
 
90
- > **_NOTE:_** Vue3 needs some extra configuration
92
+ #### Vue 3 extra configuration
91
93
 
92
- ```shell
93
- make npm "i @vue/eslint-config-typescript --save-exact --save-dev"
94
- ```
95
-
96
- ```shell
97
- make pnpm "i @vue/eslint-config-typescript --save-exact --save-dev"
98
- ```
94
+ > [!IMPORTANT]
95
+ > For Vue 3 TypeScript is mandatory, so [install the TS packages](#typescript-projects) as described in the TypeScript section.
99
96
 
100
97
  And set the following extend in `.eslintrc.js`:
101
98
 
@@ -103,8 +100,7 @@ And set the following extend in `.eslintrc.js`:
103
100
  module.exports = {
104
101
  extends: [
105
102
  '@bitfactory/eslint-config/vue',
106
- 'plugin:vue/vue3-recommended', // <-- add this one
107
- '@vue/typescript/recommended', // <-- and this one
103
+ 'plugin:vue/vue3-recommended',
108
104
  '@bitfactory/eslint-config/typescript',
109
105
  ],
110
106
  };
@@ -112,14 +108,17 @@ module.exports = {
112
108
 
113
109
  ### TypeScript projects
114
110
 
115
- To use this config with a TypeScript project also install the following packages
111
+ To use this config with a TypeScript project _also_ install the following packages
112
+
113
+ > [!NOTE]
114
+ > Check and make sure a compatible TypeScript version is installed. Can be added with: `make [p]npm i typescript`.
116
115
 
117
116
  ```shell
118
- make npm "i @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import --save-dev --save-exact"
117
+ make npm "i @typescript-eslint/eslint-plugin @typescript-eslint/parse --save-dev --save-exact"
119
118
  ```
120
119
 
121
120
  ```shell
122
- make pnpm "i @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import --save-dev --save-exact"
121
+ make pnpm "i @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev --save-exact"
123
122
  ```
124
123
 
125
124
  And set the following extend in `.eslintrc.js`:
@@ -132,15 +131,11 @@ module.exports = {
132
131
 
133
132
  ### Vue.js, TypeScript and regular JavaScript together
134
133
 
135
- To use this config with a Vue.js, TypeScript and regular JavaScript project also install the following packages
134
+ To use this config with a Vue.js, TypeScript and regular JavaScript together in one project make sure to install the packages from all three sections:
136
135
 
137
- ```shell
138
- make npm "i eslint-plugin-vue eslint-plugin-vuejs-accessibility @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import @vue/eslint-config-typescript --save-dev --save-exact"
139
- ```
140
-
141
- ```shell
142
- make pnpm "i eslint-plugin-vue eslint-plugin-vuejs-accessibility @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import @vue/eslint-config-typescript --save-dev --save-exact"
143
- ```
136
+ - [:package: Installing](#package-installing)
137
+ - [Vue.js projects](#vuejs-projects)
138
+ - [TypeScript projects](#typescript-projects)
144
139
 
145
140
  And set the following extend in `.eslintrc.js`:
146
141
 
@@ -148,8 +143,7 @@ And set the following extend in `.eslintrc.js`:
148
143
  module.exports = {
149
144
  extends: [
150
145
  '@bitfactory/eslint-config/vue',
151
- 'plugin:vue/vue3-recommended',
152
- '@vue/typescript/recommended',
146
+ // 'plugin:vue/vue3-recommended', // <-- add this only for Vue 3
153
147
  '@bitfactory/eslint-config/typescript',
154
148
  ],
155
149
  };
@@ -222,6 +216,7 @@ make pnpm run eslint:fix
222
216
  ## :pencil2: Editor / IDE integration
223
217
 
224
218
  For ESLint to work, you need to set up your editor / IDE.
219
+ See also <https://eslint.style/guide/faq#how-to-auto-format-on-save>
225
220
 
226
221
  ### Visual Studio Code
227
222
 
package/index.js CHANGED
@@ -8,6 +8,7 @@ module.exports = {
8
8
  },
9
9
  extends: [
10
10
  'eslint:recommended',
11
+ 'plugin:@stylistic/recommended-extends',
11
12
  'plugin:jsdoc/recommended',
12
13
  'plugin:unicorn/recommended',
13
14
  './rules/errors',
@@ -15,6 +16,7 @@ module.exports = {
15
16
  './rules/jsdoc',
16
17
  './rules/practices',
17
18
  './rules/style',
19
+ './rules/stylistic',
18
20
  './rules/variables',
19
21
  ],
20
22
  ignorePatterns: [
@@ -35,6 +37,7 @@ module.exports = {
35
37
  sourceType: 'module',
36
38
  },
37
39
  plugins: [
40
+ '@stylistic',
38
41
  'jsdoc',
39
42
  'unicorn',
40
43
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitfactory/eslint-config",
3
- "version": "3.3.1",
3
+ "version": "4.1.0",
4
4
  "description": "ESLint sharable config for Bitfactory projects",
5
5
  "keywords": [
6
6
  "eslint",
@@ -18,14 +18,15 @@
18
18
  "vue.js"
19
19
  ],
20
20
  "devDependencies": {
21
- "eslint": "9.16.0",
22
- "lint-staged": "15.2.10",
23
- "npm-check-updates": "17.1.11",
21
+ "eslint": "9.19.0",
22
+ "lint-staged": "15.4.3",
23
+ "npm-check-updates": "17.1.14",
24
24
  "simple-git-hooks": "2.11.1"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@babel/core": "^7.24.5",
28
28
  "@babel/eslint-parser": "^7.24.5",
29
+ "@stylistic/eslint-plugin": ">=2.6.0",
29
30
  "eslint": "^8.56.0 || ^9.0.0",
30
31
  "eslint-plugin-import": ">=2.31.0",
31
32
  "eslint-plugin-jsdoc": ">=47.0.0",
package/rules/es6.js CHANGED
@@ -6,11 +6,7 @@ module.exports = {
6
6
  ],
7
7
  rules: {
8
8
  'arrow-body-style': ['error', 'as-needed'],
9
- 'arrow-parens': ['error', 'as-needed'],
10
- 'arrow-spacing': 'error',
11
- 'generator-star-spacing': ['error', 'after'],
12
9
  'import/no-duplicates': ['error'],
13
- 'no-confusing-arrow': 'error',
14
10
  'no-duplicate-imports': [
15
11
  'error',
16
12
  {
@@ -41,9 +37,6 @@ module.exports = {
41
37
  'prefer-rest-params': 'error',
42
38
  'prefer-spread': 'error',
43
39
  'prefer-template': 'error',
44
- 'rest-spread-spacing': 'error',
45
40
  'symbol-description': 'error',
46
- 'template-curly-spacing': 'error',
47
- 'yield-star-spacing': ['error', 'after'],
48
41
  },
49
42
  };
@@ -20,7 +20,6 @@ module.exports = {
20
20
  'no-extend-native': 'error',
21
21
  'no-extra-bind': 'error',
22
22
  'no-extra-label': 'error',
23
- 'no-floating-decimal': 'error',
24
23
  'no-implicit-coercion': 'error',
25
24
  'no-implicit-globals': 'error',
26
25
  'no-implied-eval': 'error',
@@ -28,7 +27,6 @@ module.exports = {
28
27
  'no-labels': 'error',
29
28
  'no-lone-blocks': 'error',
30
29
  'no-loop-func': 'error',
31
- 'no-multi-spaces': 'error',
32
30
  'no-multi-str': 'error',
33
31
  'no-new-func': 'error',
34
32
  'no-new-wrappers': 'error',
package/rules/style.js CHANGED
@@ -2,37 +2,12 @@
2
2
 
3
3
  module.exports = {
4
4
  rules: {
5
- 'array-bracket-newline': ['error', 'consistent'],
6
- 'array-bracket-spacing': 'error',
7
- 'array-element-newline': ['error', 'consistent'],
8
- 'block-spacing': 'error',
9
- 'brace-style': 'error',
10
5
  'camelcase': 'error',
11
- 'comma-dangle': ['error', 'always-multiline'],
12
- 'comma-spacing': 'error',
13
- 'comma-style': 'error',
14
- 'computed-property-spacing': 'error',
15
6
  'consistent-this': 'error',
16
- 'eol-last': 'error',
17
7
  'func-name-matching': 'error',
18
8
  'func-names': ['error', 'never'],
19
9
  'func-style': 'error',
20
- 'implicit-arrow-linebreak': 'error',
21
- 'indent': ['error', 4, {
22
- SwitchCase: 1,
23
- }],
24
- 'key-spacing': 'error',
25
- 'keyword-spacing': 'error',
26
- 'line-comment-position': 'error',
27
- 'linebreak-style': 'error',
28
- 'lines-between-class-members': 'error',
29
10
  'max-depth': 'error',
30
- 'max-len': [
31
- 'warn',
32
- {
33
- code: 120,
34
- },
35
- ],
36
11
  'max-lines': 'warn',
37
12
  'max-lines-per-function': [
38
13
  'warn',
@@ -43,21 +18,10 @@ module.exports = {
43
18
  ],
44
19
  'max-params': 'error',
45
20
  'max-statements': 'warn',
46
- 'max-statements-per-line': 'error',
47
- 'multiline-ternary': ['error', 'never'],
48
21
  'new-cap': 'error',
49
- 'new-parens': 'error',
50
- 'newline-per-chained-call': 'error',
51
22
  'no-array-constructor': 'error',
52
23
  'no-lonely-if': 'error',
53
- 'no-mixed-operators': 'error',
54
24
  'no-multi-assign': 'error',
55
- 'no-multiple-empty-lines': [
56
- 'error',
57
- {
58
- max: 1,
59
- },
60
- ],
61
25
  'no-negated-condition': 'error',
62
26
  'no-new-object': 'error',
63
27
  'no-plusplus': [
@@ -66,8 +30,6 @@ module.exports = {
66
30
  allowForLoopAfterthoughts: true,
67
31
  },
68
32
  ],
69
- 'no-tabs': 'error',
70
- 'no-trailing-spaces': 'error',
71
33
  'no-underscore-dangle': [
72
34
  'error',
73
35
  {
@@ -80,69 +42,12 @@ module.exports = {
80
42
  defaultAssignment: false,
81
43
  },
82
44
  ],
83
- 'no-whitespace-before-property': 'error',
84
- 'object-curly-newline': ['error', {
85
- ExportDeclaration: {
86
- minProperties: 2,
87
- multiline: true,
88
- },
89
- ImportDeclaration: {
90
- minProperties: 4,
91
- multiline: true,
92
- },
93
- ObjectExpression: {
94
- minProperties: 1,
95
- multiline: true,
96
- },
97
- ObjectPattern: {
98
- minProperties: 4,
99
- multiline: true,
100
- },
101
- }],
102
- 'object-curly-spacing': ['error', 'always'],
103
- 'object-property-newline': 'error',
104
45
  'one-var': ['error', 'never'],
105
- 'one-var-declaration-per-line': ['error', 'always'],
106
46
  'operator-assignment': 'error',
107
- 'operator-linebreak': ['error', 'after'],
108
- 'padding-line-between-statements': [
109
- 'error',
110
- {
111
- blankLine: 'always',
112
- next: 'return',
113
- prev: '*',
114
- },
115
- ],
116
47
  'prefer-object-spread': 'error',
117
- 'quote-props': ['error', 'consistent-as-needed'],
118
- 'quotes': [
119
- 'error',
120
- 'single',
121
- {
122
- allowTemplateLiterals: false,
123
- avoidEscape: true,
124
- },
125
- ],
126
- 'semi': 'error',
127
- 'semi-style': 'error',
128
48
  'sort-imports': ['error', {
129
49
  ignoreDeclarationSort: true,
130
50
  }],
131
51
  'sort-vars': 'error',
132
- 'space-before-blocks': 'error',
133
- 'space-before-function-paren': ['error', 'never'],
134
- 'space-in-parens': 'error',
135
- 'space-infix-ops': 'error',
136
- 'space-unary-ops': [
137
- 'error',
138
- {
139
- nonwords: false,
140
- words: true,
141
- },
142
- ],
143
- 'spaced-comment': 'error',
144
- 'switch-colon-spacing': 'error',
145
- 'template-tag-spacing': 'error',
146
- 'wrap-regex': 'error',
147
52
  },
148
53
  };
@@ -0,0 +1,118 @@
1
+ /* eslint-disable unicorn/prefer-module */
2
+
3
+ module.exports = {
4
+ rules: {
5
+ '@stylistic/array-bracket-newline': ['error', 'consistent'],
6
+ '@stylistic/array-bracket-spacing': 'error',
7
+ '@stylistic/array-element-newline': ['error', 'consistent'],
8
+ '@stylistic/arrow-parens': ['error', 'as-needed'],
9
+ '@stylistic/arrow-spacing': 'error',
10
+ '@stylistic/block-spacing': 'error',
11
+ '@stylistic/brace-style': ['error', '1tbs'],
12
+ '@stylistic/comma-dangle': ['error', 'always-multiline'],
13
+ '@stylistic/comma-spacing': 'error',
14
+ '@stylistic/comma-style': 'error',
15
+ '@stylistic/computed-property-spacing': 'error',
16
+ '@stylistic/eol-last': 'error',
17
+ '@stylistic/generator-star-spacing': ['error', 'after'],
18
+ '@stylistic/implicit-arrow-linebreak': 'error',
19
+ '@stylistic/indent': ['error', 4, {
20
+ SwitchCase: 1,
21
+ }],
22
+ '@stylistic/indent-binary-ops': ['error', 4],
23
+ '@stylistic/key-spacing': 'error',
24
+ '@stylistic/keyword-spacing': 'error',
25
+ '@stylistic/line-comment-position': 'error',
26
+ '@stylistic/linebreak-style': 'error',
27
+ '@stylistic/lines-between-class-members': 'error',
28
+ '@stylistic/max-len': ['warn', {
29
+ code: 120,
30
+ }],
31
+ '@stylistic/max-statements-per-line': 'error',
32
+ '@stylistic/member-delimiter-style': ['error', {
33
+ multiline: {
34
+ delimiter: 'semi',
35
+ requireLast: true,
36
+ },
37
+ singleline: {
38
+ delimiter: 'semi',
39
+ requireLast: false,
40
+ },
41
+ multilineDetection: 'brackets',
42
+ }],
43
+ '@stylistic/multiline-comment-style': ['error', 'separate-lines'],
44
+ '@stylistic/multiline-ternary': ['error', 'never'],
45
+ '@stylistic/new-parens': 'error',
46
+ '@stylistic/newline-per-chained-call': 'error',
47
+ '@stylistic/no-confusing-arrow': 'error',
48
+ '@stylistic/no-extra-parens': ['error', 'functions'],
49
+ '@stylistic/no-floating-decimal': 'error',
50
+ '@stylistic/no-mixed-operators': 'error',
51
+ '@stylistic/no-multi-spaces': 'error',
52
+ '@stylistic/no-multiple-empty-lines': ['error', {
53
+ max: 1,
54
+ }],
55
+ '@stylistic/no-tabs': 'error',
56
+ '@stylistic/no-trailing-spaces': 'error',
57
+ '@stylistic/no-whitespace-before-property': 'error',
58
+ '@stylistic/object-curly-newline': ['error', {
59
+ ExportDeclaration: {
60
+ minProperties: 2,
61
+ multiline: true,
62
+ },
63
+ ImportDeclaration: {
64
+ minProperties: 4,
65
+ multiline: true,
66
+ },
67
+ ObjectExpression: {
68
+ minProperties: 1,
69
+ multiline: true,
70
+ },
71
+ ObjectPattern: {
72
+ minProperties: 4,
73
+ multiline: true,
74
+ },
75
+ }],
76
+ '@stylistic/object-curly-spacing': ['error', 'always'],
77
+ '@stylistic/object-property-newline': 'error',
78
+ '@stylistic/one-var-declaration-per-line': ['error', 'always'],
79
+ '@stylistic/operator-linebreak': ['error', 'after'],
80
+ '@stylistic/padding-line-between-statements': ['error', {
81
+ blankLine: 'always',
82
+ next: 'return',
83
+ prev: '*',
84
+ }],
85
+ '@stylistic/rest-spread-spacing': 'error',
86
+ '@stylistic/quote-props': ['error', 'consistent-as-needed'],
87
+ '@stylistic/quotes': ['error', 'single', {
88
+ allowTemplateLiterals: false,
89
+ avoidEscape: true,
90
+ }],
91
+ '@stylistic/semi': ['error', 'always'],
92
+ '@stylistic/semi-style': 'error',
93
+ '@stylistic/space-before-blocks': 'error',
94
+ '@stylistic/space-before-function-paren': ['error', 'never'],
95
+ '@stylistic/space-in-parens': 'error',
96
+ '@stylistic/space-infix-ops': 'error',
97
+ '@stylistic/space-unary-ops': ['error', {
98
+ nonwords: false,
99
+ words: true,
100
+ }],
101
+ '@stylistic/spaced-comment': 'error',
102
+ '@stylistic/switch-colon-spacing': 'error',
103
+ '@stylistic/template-curly-spacing': 'error',
104
+ '@stylistic/template-tag-spacing': 'error',
105
+ '@stylistic/type-annotation-spacing': ['error', {
106
+ before: false,
107
+ after: true,
108
+ overrides: {
109
+ arrow: {
110
+ before: true,
111
+ after: true,
112
+ },
113
+ },
114
+ }],
115
+ '@stylistic/wrap-regex': 'error',
116
+ '@stylistic/yield-star-spacing': ['error', 'after'],
117
+ },
118
+ };
package/typescript.js CHANGED
@@ -20,7 +20,6 @@ module.exports = {
20
20
  prefer: 'type-imports',
21
21
  },
22
22
  ],
23
- '@typescript-eslint/member-delimiter-style': 'error',
24
23
  'no-duplicate-imports': 'off',
25
24
  },
26
25
  },