Skip to content

Commit 1f32bfc

Browse files
committed
v6.1.5 - typescsript es5 target adjustments
1 parent 900b333 commit 1f32bfc

File tree

5 files changed

+55
-38
lines changed

5 files changed

+55
-38
lines changed

HISTORY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# History
22

3+
## v6.1.5 2025 August 8
4+
5+
- Renamed the rule extensions for brevity and clarity
6+
- Add `eslint-config-bevry/typescript/es5` configuration for TypeScript ES5 targets, which ignores the `@typescript-eslint/prefer-for-of` rule, as it is not supported in ES5
7+
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
8+
- Thank you to the sponsors: [Andrew Nesbitt](https://nesbitt.io), [Divinci ™](https://divinci.ai), [Mr. Henry](https://mrhenry.be), [Poonacha Medappa](https://poonachamedappa.com), [Roboflow](https://roboflow.com), [Square](https://github.com/square)
9+
310
## v6.1.4 2025 August 8
411

512
- Disable potentially useful but broken `n/no-unsupported-features/es-syntax` rule, as it does not respect the `ecmaVersion` setting, and instead prefers to use the Node.js engine version, which is not what we want when using a transpiler, and is disrespectful as our configuration knows better, hence why there is even an `ecmaVersion` setting in the first place, they should rename this rule to `n/no-unsupported-features/node-syntax` as that it what it actually is

package-lock.json

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-bevry",
3-
"version": "6.1.4",
3+
"version": "6.1.5",
44
"license": "Artistic-2.0",
55
"description": "Intelligent, self-configuring ESLint configuration that automatically analyzes your project structure, dependencies, and metadata to apply optimal linting rules for JavaScript, TypeScript, React, Node.js, and more.",
66
"homepage": "https://github.com/bevry/eslint-config-bevry",
@@ -19,6 +19,7 @@
1919
"eslint",
2020
"eslint-config",
2121
"eslintconfig",
22+
"esnext",
2223
"export-default",
2324
"flow",
2425
"flow-type",
@@ -120,7 +121,8 @@
120121
"WriterJohnBuck (https://github.com/WriterJohnBuck)"
121122
],
122123
"engines": {
123-
"node": ">=20"
124+
"node": ">=20",
125+
"ecmascript": ">= esnext"
124126
},
125127
"editions": [
126128
{
@@ -153,7 +155,7 @@
153155
"@eslint/js": "^9.33.0",
154156
"eslint-config-prettier": "^10.1.8",
155157
"eslint-plugin-import": "^2.32.0",
156-
"eslint-plugin-jsdoc": "^53.0.0",
158+
"eslint-plugin-jsdoc": "^53.0.1",
157159
"eslint-plugin-n": "^17.21.3",
158160
"eslint-plugin-react": "^7.37.5",
159161
"eslint-plugin-react-hooks": "^5.2.0",

source/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ const config = {
6060
'**/edition-*/',
6161
...(pkg.eslintConfig?.ignores || []),
6262
]),
63-
rules.beforeEslintRecommended,
63+
rules.jsBefore,
6464
eslintJS.configs.recommended,
65-
rules.afterEslintRecommended,
65+
rules.jsAfter,
6666
],
6767
languageOptions: {
6868
// ecmaVersion: null,
@@ -315,10 +315,7 @@ if (sourceType === 'module') {
315315
if (react) {
316316
config.extends.push(eslintImport.flatConfigs.react)
317317
}
318-
config.extends.push(
319-
eslintImport.flatConfigs.typescript,
320-
rules.afterImportRecommended,
321-
)
318+
config.extends.push(eslintImport.flatConfigs.typescript, rules.importAfter)
322319
}
323320

324321
// node
@@ -341,9 +338,9 @@ if (node) {
341338
...globals.node,
342339
...globals.nodeBuiltin,
343340
}
344-
config.extends.push(rules.afterNodeRecommended)
341+
config.extends.push(rules.nodeAfter)
345342
if (typescript || babel) {
346-
config.extends.push(rules.afterNodeCompiledRecommended)
343+
config.extends.push(rules.nodeCompiled)
347344
}
348345
}
349346
if (browser) {
@@ -392,10 +389,13 @@ if (typescript) {
392389
eslintTypescript.configs.stylisticTypeChecked,
393390

394391
// our overrides
395-
rules.afterTypescriptRecommended,
392+
rules.typescriptAfter,
396393
)
394+
if (ecmascriptVersionTarget <= 5) {
395+
config.extends.push(rules.typescriptEs5)
396+
}
397397
if (ecmascriptVersionTarget <= 2015) {
398-
config.extends.push(rules.typescriptEcmascript2015Target)
398+
config.extends.push(rules.typescriptEs2015)
399399
}
400400
config.extends.push(rules.typescriptTests)
401401
} else {
@@ -418,7 +418,7 @@ if (prettier) {
418418

419419
// this is after typescript, as we need to override defaults from typescript configs
420420
if (ecmascriptVersionSource <= 5) {
421-
config.extends.push(rules.ecmascript5Source)
421+
config.extends.push(rules.es5)
422422
}
423423

424424
// user rules overrides

source/rules.js

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export const MAX_PARAMS = 4
77
// Rules intended to be overwrote by ESLint Recommended
88
// https://unpkg.com/@eslint/js@9/src/configs/eslint-recommended.js
99

10-
export const beforeEslintRecommended = {
11-
name: 'eslint-config-bevry/before-eslint-recommended',
10+
export const jsBefore = {
11+
name: 'eslint-config-bevry/js/before',
1212
rules: {
1313
// https://eslint.org/docs/latest/rules/constructor-super
1414
// eslint/recommended will override this to error
@@ -200,8 +200,8 @@ export const beforeEslintRecommended = {
200200
// Rules intended to overwrite ESLint Recommended
201201
// https://unpkg.com/@eslint/js@9/src/configs/eslint-recommended.js
202202

203-
export const afterEslintRecommended = {
204-
name: 'eslint-config-bevry/rules-after-eslint-recommended',
203+
export const jsAfter = {
204+
name: 'eslint-config-bevry/js/after',
205205
rules: {
206206
// https://eslint.org/docs/latest/rules/no-cond-assign
207207
// eslint/recommended defaulted this to allow sometimes
@@ -1071,8 +1071,8 @@ export const afterEslintRecommended = {
10711071
// Adjustments
10721072

10731073
// These are adjustments based on the source ecmascript version, as the transpiler handles them
1074-
export const ecmascript5Source = {
1075-
name: 'eslint-config-bevry/eslint-five',
1074+
export const es5 = {
1075+
name: 'eslint-config-bevry/es5',
10761076
rules: {
10771077
'no-var': IGNORE,
10781078
'object-shorthand': [ERROR, 'never'],
@@ -1082,8 +1082,8 @@ export const ecmascript5Source = {
10821082
},
10831083
}
10841084

1085-
export const afterImportRecommended = {
1086-
name: 'eslint-config-bevry/after-import-recommended',
1085+
export const importAfter = {
1086+
name: 'eslint-config-bevry/import/after',
10871087
rules: {
10881088
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md
10891089
// This is broken for javascript and typescript projects, including this project on `typescript-eslint` and `eslint-plugin-jsdoc`
@@ -1095,8 +1095,8 @@ export const afterImportRecommended = {
10951095
// https://github.com/eslint-community/eslint-plugin-n?tab=readme-ov-file#-rules
10961096
// https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/all-rules.js
10971097
// None of these should be set by the recommended configs
1098-
export const afterNodeRecommended = {
1099-
name: 'eslint-config-bevry/after-node-recommended',
1098+
export const nodeAfter = {
1099+
name: 'eslint-config-bevry/node/after',
11001100
rules: {
11011101
// https://eslint.org/docs/latest/rules/callback-return
11021102
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/callback-return.md
@@ -1145,17 +1145,17 @@ export const afterNodeRecommended = {
11451145
},
11461146
}
11471147

1148-
export const afterNodeCompiledRecommended = {
1149-
name: 'eslint-config-bevry/after-node-compiled-recommended',
1148+
export const nodeCompiled = {
1149+
name: 'eslint-config-bevry/node/compiled',
11501150
rules: {
11511151
//https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules//no-unsupported-features/es-syntax.md
11521152
// This rule is broken. It uses the node.js engine version instead of the specified ecmaVersion, and as we use a transpiler the Node.js engine version is expanded beyond the capabilities of our source. There is no configuration to get this rule to actually use the specificied ecmaVersion for the ecmascript syntax - this rule as such should be renamed to node-syntax, NOT es-syntax.
11531153
'n/no-unsupported-features/es-syntax': IGNORE,
11541154
},
11551155
}
11561156

1157-
export const afterTypescriptRecommended = {
1158-
name: 'eslint-config-bevry/after-typescript-recommended',
1157+
export const typescriptAfter = {
1158+
name: 'eslint-config-bevry/typescript/after',
11591159
rules: {
11601160
// this typescript-eslint does not modify, however typescript handles them better
11611161
'no-use-before-define': IGNORE,
@@ -1185,18 +1185,23 @@ export const afterTypescriptRecommended = {
11851185
},
11861186
}
11871187

1188-
// @todo these may not be needed now that we are more aware of our ecmascript versions
11891188
// These are adjustments based on the target ecmascript version, as the transpiler does not handle them
1190-
export const typescriptEcmascript2015Target = {
1191-
name: 'eslint-config-bevry/typescript-ecmascript-2015-overrides',
1189+
export const typescriptEs5 = {
1190+
name: 'eslint-config-bevry/typescript/es5',
1191+
rules: {
1192+
'@typescript-eslint/prefer-for-of': IGNORE, // came in ES2015
1193+
},
1194+
}
1195+
export const typescriptEs2015 = {
1196+
name: 'eslint-config-bevry/typescript/es2015',
11921197
rules: {
11931198
'@typescript-eslint/prefer-includes': IGNORE, // came in ES2016
11941199
},
11951200
}
11961201

11971202
// allow unsafe types in our test files, as how else are we meant to test that unsafe inputs will be handled correctly?
11981203
export const typescriptTests = {
1199-
name: 'eslint-config-bevry/typescript-test-overrides',
1204+
name: 'eslint-config-bevry/typescript/tests',
12001205
files: ['**/test.{js,cjs,mjs,jsx,mjsx,ts,cts,mts,tsx,mtsx}'],
12011206
rules: {
12021207
'@typescript-eslint/no-explicit-any': WARN,

0 commit comments

Comments
 (0)