Skip to content

Commit 74792e1

Browse files
authored
Support for @typescript-eslint/*@6.x.x (#669)
* Closes Support for @typescript-eslint/*@6.x.x #665 * Consolidate to managed rulesets * unicorn 48 * Bump 📦 to pick up fix for linting package
1 parent a019ff6 commit 74792e1

File tree

8 files changed

+4086
-11325
lines changed

8 files changed

+4086
-11325
lines changed

.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: ['eslint-config-tc', './index.js'],
3+
parserOptions: {
4+
project: './tsconfig.eslint.json',
5+
tsconfigRootDir: __dirname,
6+
},
7+
};

.eslintrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
[![license](https://img.shields.io/github/license/tclindner/eslint-config-typescript-tc.svg?maxAge=2592000&style=flat-square)](https://github.com/tclindner/eslint-config-typescript-tc/blob/main/LICENSE)
66
[![npm](https://img.shields.io/npm/v/eslint-config-typescript-tc.svg?maxAge=2592000?style=flat-square)](https://www.npmjs.com/package/eslint-config-typescript-tc)
77
![ci](https://github.com/tclindner/eslint-config-typescript-tc/workflows/ci/badge.svg?branch=main)
8-
[![Dependency Status](https://david-dm.org/tclindner/eslint-config-typescript-tc.svg?style=flat-square)](https://david-dm.org/tclindner/eslint-config-typescript-tc)
9-
[![devDependency Status](https://david-dm.org/tclindner/eslint-config-typescript-tc/dev-status.svg?style=flat-square)](https://david-dm.org/tclindner/eslint-config-typescript-tc#info=devDependencies)
108

119
## What is eslint-config-typescript-tc?
1210

@@ -35,23 +33,31 @@ npx install-peerdeps --dev eslint-config-typescript-tc
3533

3634
## Usage
3735

38-
Add the following to your `.eslintrc.json` file:
36+
Add the following to your `.eslintrc.js` file:
3937

40-
```json
41-
{
42-
"extends": "eslint-config-typescript-tc"
43-
}
38+
```js
39+
module.exports = {
40+
extends: ['eslint-config-tc', 'eslint-config-typescript-tc'],
41+
parserOptions: {
42+
project: './tsconfig.json',
43+
tsconfigRootDir: __dirname,
44+
},
45+
};
4446
```
4547

46-
If you need to override a rule, your `.eslintrc.json` file should look like the example below. All shared rules will be used, but `@typescript-eslint/array-type` will be turned off.
48+
If you need to override a rule, your `.eslintrc.js` file should look like the example below. All shared rules will be used, but `@typescript-eslint/array-type` will be turned off.
4749

48-
```json
49-
{
50-
"extends": "eslint-config-typescript-tc",
50+
```js
51+
module.exports = {
52+
extends: ['eslint-config-tc', 'eslint-config-typescript-tc'],
53+
parserOptions: {
54+
project: './tsconfig.json',
55+
tsconfigRootDir: __dirname,
56+
},
5157
"rules": {
5258
"@typescript-eslint/array-type": "off"
5359
}
54-
}
60+
};
5561
```
5662

5763
## Related

index.js

Lines changed: 8 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
/* eslint-disable @typescript-eslint/naming-convention */
22
module.exports = {
3-
extends: ['plugin:@typescript-eslint/recommended', 'eslint-config-prettier'],
3+
extends: [
4+
'plugin:@typescript-eslint/recommended',
5+
'plugin:@typescript-eslint/stylistic',
6+
'plugin:@typescript-eslint/strict',
7+
'eslint-config-prettier',
8+
],
49
parser: '@typescript-eslint/parser',
510
plugins: ['@typescript-eslint', 'prettier'],
611
settings: {
@@ -16,21 +21,8 @@ module.exports = {
1621
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
1722
},
1823
rules: {
19-
// @typescript-eslint rules
20-
// -----------------------------
21-
22-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md
23-
'@typescript-eslint/array-type': ['error', {default: 'array'}],
24-
25-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
26-
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
27-
28-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
29-
// disable the rule for all files, see overrides below.
30-
'@typescript-eslint/explicit-function-return-type': 'off',
31-
32-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/method-signature-style.md
33-
'@typescript-eslint/method-signature-style': 'error',
24+
// @typescript-eslint overrides that work better than ESLint.
25+
// The base rule needs to be disabled to prevent false positives.
3426

3527
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
3628
camelcase: 'off',
@@ -60,38 +52,10 @@ module.exports = {
6052
},
6153
],
6254

63-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dynamic-delete.md
64-
'@typescript-eslint/no-dynamic-delete': 'error',
65-
66-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
67-
'@typescript-eslint/no-explicit-any': 'error',
68-
69-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md
70-
'@typescript-eslint/prefer-enum-initializers': 'error',
71-
72-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-optional-chain.md
73-
'@typescript-eslint/prefer-optional-chain': 'error',
74-
75-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md
76-
'@typescript-eslint/prefer-ts-expect-error': 'error',
77-
78-
// @typescript-eslint overrides
79-
// that work better than ESLint
80-
// The base rule needs to be disabled to prevent false positives.
81-
// -----------------------------
82-
83-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
84-
'lines-between-class-members': 'off',
85-
'@typescript-eslint/lines-between-class-members': ['error'],
86-
8755
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
8856
'no-dupe-class-members': 'off',
8957
'@typescript-eslint/no-dupe-class-members': ['error'],
9058

91-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
92-
'no-empty-function': 'off',
93-
'@typescript-eslint/no-empty-function': ['error'],
94-
9559
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
9660
'no-loop-func': 'off',
9761
'@typescript-eslint/no-loop-func': 'error',
@@ -104,10 +68,6 @@ module.exports = {
10468
'no-shadow': 'off',
10569
'@typescript-eslint/no-shadow': ['error'],
10670

107-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
108-
'no-array-constructor': 'off',
109-
'@typescript-eslint/no-array-constructor': ['error'],
110-
11171
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
11272
'no-unused-expressions': 'off',
11373
'@typescript-eslint/no-unused-expressions': ['error'],
@@ -116,14 +76,6 @@ module.exports = {
11676
'no-use-before-define': 'off',
11777
'@typescript-eslint/no-use-before-define': ['error'],
11878

119-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
120-
'no-useless-constructor': 'off',
121-
'@typescript-eslint/no-useless-constructor': ['error'],
122-
123-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
124-
'no-unused-vars': 'off',
125-
'@typescript-eslint/no-unused-vars': 'error',
126-
12779
// Override Airbnb 'import/extensions' rule. Add 'ts' and 'tsx'.
12880
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
12981
'import/extensions': [

0 commit comments

Comments
 (0)