Skip to content

Commit 44ea759

Browse files
committed
build: raise TypeScript linting toolchain floor
Upgrade the TypeScript linting stack to support ESLint v9: - Upgrade TypeScript from 4.3.5 to 4.9.5 (minimum for typescript-eslint v8 is >=4.8.4) - Upgrade `@typescript-eslint/parser` and `@typescript-eslint/eslint-plugin` from v6 to v8 - Install `@stylistic/eslint-plugin-ts` for formatting rules that were removed from typescript-eslint in v8 - Replace removed rules in `etc/eslint/rules/typescript.js`: - `@typescript-eslint/indent` → `@stylistic/ts/indent` - `@typescript-eslint/member-delimiter-style` → `@stylistic/ts/member-delimiter-style` - `@typescript-eslint/quotes` → `@stylistic/ts/quotes` - `@typescript-eslint/semi` → `@stylistic/ts/semi` - `@typescript-eslint/space-before-function-paren` → `@stylistic/ts/space-before-function-paren` - `@typescript-eslint/type-annotation-spacing` → `@stylistic/ts/type-annotation-spacing` - `@typescript-eslint/ban-types` → `@typescript-eslint/no-restricted-types` (was already off) Ref: stdlib-js/metr-issue-tracker#54
1 parent e0e5a99 commit 44ea759

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

etc/eslint/plugins/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
// ESLint plugins:
2222
var plugins = [
23+
'@stylistic/ts',
2324
'jsdoc',
2425
'n',
2526
'stdlib',

etc/eslint/rules/typescript.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ rules[ '@typescript-eslint/ban-ts-comment' ] = 'off';
137137
* type foo = {};
138138
* type bar = object;
139139
*/
140-
rules[ '@typescript-eslint/ban-types' ] = 'off';
140+
rules[ '@typescript-eslint/no-restricted-types' ] = 'off';
141141

142142
/**
143143
* Enforces the use of consistent type assertions.
@@ -286,7 +286,7 @@ rules[ '@typescript-eslint/explicit-module-boundary-types' ] = 'error';
286286
* return true;
287287
* }
288288
*/
289-
rules[ '@typescript-eslint/indent' ] = [ 'error', 'tab' ];
289+
rules[ '@stylistic/ts/indent' ] = [ 'error', 'tab' ];
290290

291291
/**
292292
* Enforces a specific member delimiter style in interfaces and type literals.
@@ -310,7 +310,7 @@ rules[ '@typescript-eslint/indent' ] = [ 'error', 'tab' ];
310310
* age: number;
311311
* }
312312
*/
313-
rules[ '@typescript-eslint/member-delimiter-style' ] = [
313+
rules[ '@stylistic/ts/member-delimiter-style' ] = [
314314
'error',
315315
{
316316
'multiline': {
@@ -882,7 +882,7 @@ rules[ '@typescript-eslint/promise-function-async' ] = 'off';
882882
* const good = 'good';
883883
* const goodEscape = "good's";
884884
*/
885-
rules[ '@typescript-eslint/quotes' ] = [
885+
rules[ '@stylistic/ts/quotes' ] = [
886886
'error',
887887
'single',
888888
{
@@ -946,7 +946,7 @@ rules[ '@typescript-eslint/restrict-plus-operands' ] = 'error';
946946
* // Good...
947947
* const good = 'semi';
948948
*/
949-
rules[ '@typescript-eslint/semi' ] = [ 'error', 'always' ];
949+
rules[ '@stylistic/ts/semi' ] = [ 'error', 'always' ];
950950

951951
/**
952952
* Disables the rule for strict boolean expressions.
@@ -1004,7 +1004,7 @@ rules[ '@typescript-eslint/triple-slash-reference' ] = [
10041004
* // Good...
10051005
* let good: number;
10061006
*/
1007-
rules[ '@typescript-eslint/type-annotation-spacing' ] = 'error';
1007+
rules[ '@stylistic/ts/type-annotation-spacing' ] = 'error';
10081008

10091009
/**
10101010
* Requires type annotations to exist.
@@ -2611,13 +2611,13 @@ rules[ 'radix' ] = 'error';
26112611
/**
26122612
* Enforces consistent spacing before function parentheses.
26132613
*
2614-
* @name @typescript-eslint/space-before-function-paren
2614+
* @name @stylistic/ts/space-before-function-paren
26152615
* @memberof rules
26162616
* @type {Array}
26172617
* @default [ 'error', { 'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always' } ]
26182618
* @see [space-before-function-paren]{@link https://typescript-eslint.io/rules/space-before-function-paren}
26192619
*/
2620-
rules[ '@typescript-eslint/space-before-function-paren' ] = [
2620+
rules[ '@stylistic/ts/space-before-function-paren' ] = [
26212621
'error',
26222622
{
26232623
'anonymous': 'always',

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
"@conventional-commits/parser": "^0.4.1",
125125
"@kaciras/deasync": "^1.0.1",
126126
"@types/node": "^13.9.0",
127-
"@typescript-eslint/parser": "^6.9.1",
128-
"@typescript-eslint/eslint-plugin": "^6.9.1",
127+
"@typescript-eslint/parser": "^8.57.0",
128+
"@typescript-eslint/eslint-plugin": "^8.57.0",
129129
"ajv": "^5.2.2",
130130
"browser-pack-flat": "^3.0.0",
131131
"browserify": "^17.0.0",
@@ -247,7 +247,7 @@
247247
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
248248
"to-vfile": "^6.0.0",
249249
"typedoc": "git+https://github.com/kgryte/typedoc.git#0.16.11-patch",
250-
"typescript": "4.3.5",
250+
"typescript": "4.9.5",
251251
"uglify-js": "^3.17.4",
252252
"uglifyify": "^5.0.0",
253253
"unified-lint-rule": "^1.0.1",

0 commit comments

Comments
 (0)