@studio/eslint-config 7.0.0 → 8.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.
@@ -0,0 +1,2 @@
1
+ /package.json
2
+ /CHANGES.md
package/.prettierrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "none"
4
+ }
package/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changes
2
2
 
3
+ ## 8.0.0
4
+
5
+ - 💥 [`4e97b57`](https://github.com/javascript-studio/eslint-config/commit/4e97b57c76166e3120aa6d9c8fcf56bf8b9bf484)
6
+ Upgrade eslint to v9 and use flat config
7
+ - 📚 [`78b0cb0`](https://github.com/javascript-studio/eslint-config/commit/78b0cb023c07324a59ed3d7790cba43c5a2901e5)
8
+ Update README
9
+
10
+ _Released by [Maximilian Antoni](https://github.com/mantoni) on 2024-07-28._
11
+
3
12
  ## 7.0.0
4
13
 
5
14
  - 🍏 [`1cdcfb1`](https://github.com/javascript-studio/eslint-config/commit/1cdcfb1171c7daf0aecf108bc008562789b30b71)
package/README.md CHANGED
@@ -5,24 +5,27 @@ The [sharable eslint config][docs] for all JavaScript Studio projects.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- $ npm install @studio/eslint-config eslint eslint-plugin-mocha eslint-plugin-jsdoc eslint-plugin-node --save-dev
8
+ npm i @studio/eslint-config -D
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
- Make sure this is in your `package.json`:
13
+ Configure in `eslint.config.js`:
14
14
 
15
- ```json
16
- {
17
- "eslintConfig": {
18
- "extends": "@studio"
15
+ ```js
16
+ import studio_eslint_config from '@studio/eslint-config';
17
+
18
+ export default [
19
+ ...studio_eslint_config,
20
+ {
21
+ /* Project specific overrides */
19
22
  }
20
- }
23
+ ];
21
24
  ```
22
25
 
23
26
  This configuration works great with [`@studio/tsconfig`][tsconfig].
24
27
 
25
- __Pro tip™:__ Check out [eslint_d][] for faster editor integration.
28
+ **Pro tip™:** Check out [eslint_d][] for faster editor integration.
26
29
 
27
30
  ## License
28
31
 
package/Session.vim CHANGED
@@ -14,12 +14,25 @@ if &shortmess =~ 'A'
14
14
  else
15
15
  set shortmess=aoO
16
16
  endif
17
- badd +0 README.md
17
+ badd +1 package.json
18
+ badd +0 eslint.config.js
18
19
  argglobal
19
20
  %argdel
20
- edit README.md
21
+ edit eslint.config.js
22
+ let s:save_splitbelow = &splitbelow
23
+ let s:save_splitright = &splitright
24
+ set splitbelow splitright
25
+ let &splitbelow = s:save_splitbelow
26
+ let &splitright = s:save_splitright
27
+ wincmd t
28
+ let s:save_winminheight = &winminheight
29
+ let s:save_winminwidth = &winminwidth
30
+ set winminheight=0
31
+ set winheight=1
32
+ set winminwidth=0
33
+ set winwidth=1
21
34
  argglobal
22
- balt README.md
35
+ balt package.json
23
36
  setlocal fdm=manual
24
37
  setlocal fde=0
25
38
  setlocal fmr={{{,}}}
@@ -30,7 +43,7 @@ setlocal fdn=20
30
43
  setlocal fen
31
44
  silent! normal! zE
32
45
  let &fdl = &fdl
33
- let s:l = 1 - ((0 * winheight(0) + 33) / 67)
46
+ let s:l = 1 - ((0 * winheight(0) + 20) / 40)
34
47
  if s:l < 1 | let s:l = 1 | endif
35
48
  keepjumps exe s:l
36
49
  normal! zt
@@ -43,6 +56,8 @@ endif
43
56
  unlet! s:wipebuf
44
57
  set winheight=1 winwidth=20
45
58
  let &shortmess = s:shortmess_save
59
+ let &winminheight = s:save_winminheight
60
+ let &winminwidth = s:save_winminwidth
46
61
  let s:sx = expand("<sfile>:p:r")."x.vim"
47
62
  if filereadable(s:sx)
48
63
  exe "source " . fnameescape(s:sx)
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright (c) Maximilian Antoni <max@javascript.studio>
3
+ *
4
+ * @license MIT
5
+ */
6
+ import js from '@eslint/js';
7
+ import globals from 'globals';
8
+ import plugin_n from 'eslint-plugin-n';
9
+ import plugin_jsdoc from 'eslint-plugin-jsdoc';
10
+ import plugin_mocha from 'eslint-plugin-mocha';
11
+ import rules from './lib/rules.js';
12
+
13
+ export default [
14
+ js.configs.recommended,
15
+ plugin_n.configs['flat/recommended'],
16
+ plugin_jsdoc.configs['flat/recommended'],
17
+ {
18
+ settings: {
19
+ jsdoc: {
20
+ mode: 'typescript',
21
+ preferredTypes: {
22
+ object: 'Object'
23
+ }
24
+ }
25
+ },
26
+
27
+ languageOptions: {
28
+ ecmaVersion: 'latest',
29
+ globals: {
30
+ ...globals.es5,
31
+ ...globals.node
32
+ }
33
+ },
34
+
35
+ rules
36
+ },
37
+ {
38
+ files: ['**/*.test.js', '**/*-test.js', '**/*.integration.js'],
39
+
40
+ plugins: {
41
+ mocha: plugin_mocha
42
+ },
43
+
44
+ languageOptions: {
45
+ globals: {
46
+ ...globals.mocha
47
+ }
48
+ },
49
+
50
+ rules: {
51
+ // https://github.com/lo1tuma/eslint-plugin-mocha
52
+ 'mocha/no-async-describe': 2,
53
+ 'mocha/no-exclusive-tests': 2,
54
+ 'mocha/no-identical-title': 2,
55
+ 'mocha/no-return-and-callback': 2,
56
+ 'mocha/prefer-arrow-callback': 2
57
+ }
58
+ }
59
+ ];
package/lib/rules.js ADDED
@@ -0,0 +1,129 @@
1
+ /*
2
+ * Formatting should be handled by prettier.
3
+ */
4
+ export default {
5
+ // https://github.com/gajus/eslint-plugin-jsdoc
6
+ 'jsdoc/no-undefined-types': 'error',
7
+ 'jsdoc/require-jsdoc': 'off',
8
+ 'jsdoc/require-param-description': 'off',
9
+ 'jsdoc/require-returns-description': 'off',
10
+ 'jsdoc/require-property-description': 'off',
11
+ 'jsdoc/check-indentation': 'warn',
12
+ 'jsdoc/check-line-alignment': 'warn',
13
+ 'jsdoc/require-hyphen-before-param-description': 'warn',
14
+ 'jsdoc/tag-lines': ['warn', 'never', { startLines: 1 }],
15
+
16
+ // https://github.com/eslint-community/eslint-plugin-n
17
+ 'n/handle-callback-err': 2,
18
+ 'n/no-callback-literal': 2,
19
+ 'n/no-new-require': 2,
20
+ 'n/global-require': 2,
21
+ 'n/no-mixed-requires': 2,
22
+ 'n/no-sync': 2,
23
+ 'n/prefer-global/buffer': 2,
24
+ 'n/prefer-global/console': 2,
25
+ 'n/prefer-global/process': 2,
26
+ 'n/prefer-global/text-decoder': 2,
27
+ 'n/prefer-global/text-encoder': 2,
28
+ 'n/prefer-global/url-search-params': 2,
29
+ 'n/prefer-global/url': 2,
30
+ // node default tweaks
31
+ 'n/no-unpublished-require': 0, // fails for @sinonjs/referee-sinon
32
+ 'n/no-unpublished-import': 0, // fails for commander and some @studio projects
33
+ 'n/no-missing-require': [
34
+ 2,
35
+ {
36
+ tryExtensions: ['.js', '.json']
37
+ }
38
+ ],
39
+ 'n/shebang': 0,
40
+ 'no-process-exit': 0,
41
+
42
+ // eslint default tweaks
43
+ 'no-unused-vars': [2, { args: 'after-used', argsIgnorePattern: '^_' }],
44
+
45
+ // Possible Errors (not in recommended)
46
+ 'no-template-curly-in-string': 2,
47
+ 'no-unreachable-loop': 2,
48
+ 'no-useless-backreference': 2,
49
+ 'require-atomic-updates': 2,
50
+
51
+ // Best Practices (not in recommended)
52
+ 'array-callback-return': 2,
53
+ 'block-scoped-var': 2,
54
+ complexity: 2,
55
+ 'consistent-return': 2,
56
+ curly: 2,
57
+ 'default-case': 2,
58
+ 'default-case-last': 2,
59
+ 'default-param-last': 2,
60
+ eqeqeq: 2,
61
+ 'guard-for-in': 2,
62
+ 'no-alert': 2,
63
+ 'no-caller': 2,
64
+ 'no-constructor-return': 2,
65
+ 'no-else-return': 2,
66
+ 'no-eq-null': 2,
67
+ 'no-eval': 2,
68
+ 'no-extend-native': 2,
69
+ 'no-extra-bind': 2,
70
+ 'no-extra-label': 2,
71
+ 'no-floating-decimal': 2,
72
+ 'no-implicit-coercion': 2,
73
+ 'no-implied-eval': 2,
74
+ 'no-iterator': 2,
75
+ 'no-lone-blocks': 2,
76
+ 'no-loop-func': 2,
77
+ 'no-new': 2,
78
+ 'no-new-func': 2,
79
+ 'no-new-wrappers': 2,
80
+ 'no-octal-escape': 2,
81
+ 'no-proto': 2,
82
+ 'no-restricted-properties': 2,
83
+ 'no-return-assign': 2,
84
+ 'no-return-await': 2,
85
+ 'no-self-compare': 2,
86
+ 'no-sequences': 2,
87
+ 'no-throw-literal': 2,
88
+ 'no-unmodified-loop-condition': 2,
89
+ 'no-unused-expressions': 2,
90
+ 'no-useless-call': 2,
91
+ 'no-useless-concat': 2,
92
+ 'no-useless-return': 2,
93
+ 'no-void': 2,
94
+ 'prefer-promise-reject-errors': 2,
95
+ 'prefer-regex-literals': 2,
96
+ radix: 2,
97
+ 'require-await': 2,
98
+ yoda: 2,
99
+ strict: 2,
100
+
101
+ // Variables
102
+ 'no-label-var': 2,
103
+ 'no-restricted-globals': 2,
104
+ 'no-shadow': 2,
105
+ 'no-use-before-define': [2, 'nofunc'],
106
+
107
+ // Stylistic Issues
108
+ 'comma-dangle': 2,
109
+ 'max-depth': 2,
110
+ 'max-nested-callbacks': 2,
111
+ 'new-cap': 2,
112
+ 'new-parens': 2,
113
+ 'no-array-constructor': 2,
114
+ 'no-lonely-if': 2,
115
+ 'no-new-object': 2,
116
+ 'no-unneeded-ternary': 2,
117
+ semi: 2,
118
+
119
+ // ECMAScript 6
120
+ 'no-useless-computed-key': 2,
121
+ 'no-useless-constructor': 2,
122
+ 'no-useless-rename': 2,
123
+ 'no-var': 2,
124
+ 'object-shorthand': 2,
125
+ 'prefer-arrow-callback': 2,
126
+ 'prefer-const': 2,
127
+ 'prefer-spread': 2,
128
+ 'prefer-template': 2
129
+ };
package/package.json CHANGED
@@ -1,25 +1,31 @@
1
1
  {
2
2
  "name": "@studio/eslint-config",
3
- "version": "7.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "The JavaScript Studio sharable eslint config",
5
- "main": "index.js",
5
+ "main": "eslint.config.js",
6
+ "type": "module",
6
7
  "author": "Maximilian Antoni <max@javascript.studio>",
7
8
  "homepage": "https://github.com/javascript-studio/eslint-config",
8
9
  "scripts": {
9
- "test": "eslint --config index.js index.js",
10
+ "test": "eslint *.js",
10
11
  "preversion": "npm test",
11
12
  "version": "changes --commits --footer",
12
13
  "postversion": "git push --follow-tags && npm publish"
13
14
  },
15
+ "dependencies": {
16
+ "@eslint/js": "*",
17
+ "globals": "*"
18
+ },
14
19
  "devDependencies": {
15
- "@studio/changes": "^3.0.0"
20
+ "@studio/changes": "^3.0.0",
21
+ "prettier": "^3.2.5"
16
22
  },
17
23
  "peerDependencies": {
18
- "eslint": "^8",
19
- "eslint-plugin-jsdoc": "^48.5.0",
20
- "eslint-plugin-mocha": "^10.4.3",
21
- "eslint-plugin-n": "^17.9.0",
22
- "jsdoc": "^4.0.3"
24
+ "eslint": "^9",
25
+ "eslint-plugin-jsdoc": "^48",
26
+ "eslint-plugin-mocha": "^10",
27
+ "eslint-plugin-n": "^17",
28
+ "jsdoc": "^4"
23
29
  },
24
30
  "repository": {
25
31
  "type": "git",
package/index.js DELETED
@@ -1,183 +0,0 @@
1
- /*
2
- * Copyright (c) Maximilian Antoni <max@javascript.studio>
3
- *
4
- * @license MIT
5
- */
6
- 'use strict';
7
-
8
- module.exports = {
9
-
10
- root: true,
11
-
12
- env: {
13
- node: true,
14
- es6: true
15
- },
16
-
17
- parserOptions: {
18
- ecmaVersion: 2022
19
- },
20
-
21
- plugins: [
22
- 'mocha',
23
- 'jsdoc'
24
- ],
25
-
26
- extends: [
27
- 'eslint:recommended',
28
- 'plugin:n/recommended',
29
- 'plugin:jsdoc/recommended'
30
- ],
31
-
32
- settings: {
33
- jsdoc: {
34
- mode: 'typescript',
35
- preferredTypes: {
36
- object: 'Object'
37
- }
38
- }
39
- },
40
-
41
- overrides: [{
42
- files: [
43
- '**/*.test.js',
44
- '**/*-test.js',
45
- '**/*.integration.js'
46
- ],
47
- env: {
48
- mocha: true
49
- }
50
- }],
51
-
52
- // Formatting should be handled by prettier.
53
- rules: {
54
- // https://github.com/lo1tuma/eslint-plugin-mocha
55
- 'mocha/no-async-describe': 2,
56
- 'mocha/no-exclusive-tests': 2,
57
- 'mocha/no-identical-title': 2,
58
- 'mocha/no-return-and-callback': 2,
59
- 'mocha/prefer-arrow-callback': 2,
60
-
61
- // https://github.com/gajus/eslint-plugin-jsdoc
62
- 'jsdoc/no-undefined-types': 'error',
63
- 'jsdoc/require-jsdoc': 'off',
64
- 'jsdoc/require-param-description': 'off',
65
- 'jsdoc/require-returns-description': 'off',
66
- 'jsdoc/require-property-description': 'off',
67
- 'jsdoc/check-indentation': 'warn',
68
- 'jsdoc/check-line-alignment': 'warn',
69
- 'jsdoc/require-hyphen-before-param-description': 'warn',
70
- 'jsdoc/tag-lines': ['warn', 'never', { 'startLines': 1 }],
71
-
72
- // https://github.com/eslint-community/eslint-plugin-n
73
- 'n/handle-callback-err': 2,
74
- 'n/no-callback-literal': 2,
75
- 'n/no-new-require': 2,
76
- 'n/global-require': 2,
77
- 'n/no-mixed-requires': 2,
78
- 'n/no-sync': 2,
79
- 'n/prefer-global/buffer': 2,
80
- 'n/prefer-global/console': 2,
81
- 'n/prefer-global/process': 2,
82
- 'n/prefer-global/text-decoder': 2,
83
- 'n/prefer-global/text-encoder': 2,
84
- 'n/prefer-global/url-search-params': 2,
85
- 'n/prefer-global/url': 2,
86
- // node default tweaks
87
- 'n/no-unpublished-require': 0, // fails for @sinonjs/referee-sinon
88
- 'n/no-unpublished-import': 0, // fails for commander and some @studio projects
89
- 'n/no-missing-require': [2, {
90
- 'tryExtensions': ['.js', '.json']
91
- }],
92
- 'n/shebang': 0,
93
- 'no-process-exit': 0,
94
-
95
- // eslint default tweaks
96
- 'no-unused-vars': [2, { args: 'after-used', argsIgnorePattern: '^_' }],
97
-
98
- // Possible Errors (not in recommended)
99
- 'no-template-curly-in-string': 2,
100
- 'no-unreachable-loop': 2,
101
- 'no-useless-backreference': 2,
102
- 'require-atomic-updates': 2,
103
-
104
- // Best Practices (not in recommended)
105
- 'array-callback-return': 2,
106
- 'block-scoped-var': 2,
107
- 'complexity': 2,
108
- 'consistent-return': 2,
109
- 'curly': 2,
110
- 'default-case': 2,
111
- 'default-case-last': 2,
112
- 'default-param-last': 2,
113
- 'eqeqeq': 2,
114
- 'guard-for-in': 2,
115
- 'no-alert': 2,
116
- 'no-caller': 2,
117
- 'no-constructor-return': 2,
118
- 'no-else-return': 2,
119
- 'no-eq-null': 2,
120
- 'no-eval': 2,
121
- 'no-extend-native': 2,
122
- 'no-extra-bind': 2,
123
- 'no-extra-label': 2,
124
- 'no-floating-decimal': 2,
125
- 'no-implicit-coercion': 2,
126
- 'no-implied-eval': 2,
127
- 'no-iterator': 2,
128
- 'no-lone-blocks': 2,
129
- 'no-loop-func': 2,
130
- 'no-new': 2,
131
- 'no-new-func': 2,
132
- 'no-new-wrappers': 2,
133
- 'no-octal-escape': 2,
134
- 'no-proto': 2,
135
- 'no-restricted-properties': 2,
136
- 'no-return-assign': 2,
137
- 'no-return-await': 2,
138
- 'no-self-compare': 2,
139
- 'no-sequences': 2,
140
- 'no-throw-literal': 2,
141
- 'no-unmodified-loop-condition': 2,
142
- 'no-unused-expressions': 2,
143
- 'no-useless-call': 2,
144
- 'no-useless-concat': 2,
145
- 'no-useless-return': 2,
146
- 'no-void': 2,
147
- 'prefer-promise-reject-errors': 2,
148
- 'prefer-regex-literals': 2,
149
- 'radix': 2,
150
- 'require-await': 2,
151
- 'yoda': 2,
152
- 'strict': 2,
153
-
154
- // Variables
155
- 'no-label-var': 2,
156
- 'no-restricted-globals': 2,
157
- 'no-shadow': 2,
158
- 'no-use-before-define': [2, "nofunc"],
159
-
160
- // Stylistic Issues
161
- 'comma-dangle': 2,
162
- 'max-depth': 2,
163
- 'max-nested-callbacks': 2,
164
- 'new-cap': 2,
165
- 'new-parens': 2,
166
- 'no-array-constructor': 2,
167
- 'no-lonely-if': 2,
168
- 'no-new-object': 2,
169
- 'no-unneeded-ternary': 2,
170
- 'semi': 2,
171
-
172
- // ECMAScript 6
173
- 'no-useless-computed-key': 2,
174
- 'no-useless-constructor': 2,
175
- 'no-useless-rename': 2,
176
- 'no-var': 2,
177
- 'object-shorthand': 2,
178
- 'prefer-arrow-callback': 2,
179
- 'prefer-const': 2,
180
- 'prefer-spread': 2,
181
- 'prefer-template': 2
182
- }
183
- };