Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
feat: Update to @typescript-eslint v3.1.0 (#99)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Dropped support for Node 8

BREAKING CHANGE: Dropped support for TypeScript 3.2
  • Loading branch information
iamturns authored Jun 3, 2020
1 parent 52eeb0a commit 51229f9
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 62 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ npm install eslint-config-airbnb-typescript \
eslint-plugin-jsx-a11y@^6.2.3 \
eslint-plugin-react@^7.19.0 \
eslint-plugin-react-hooks@^2.5.0 \
@typescript-eslint/eslint-plugin@^2.24.0 \
@typescript-eslint/eslint-plugin@^3.1.0 \
--save-dev
```

Expand Down Expand Up @@ -42,7 +42,7 @@ Install dependencies. ESLint plugins [must also be installed](https://github.com
```bash
npm install eslint-config-airbnb-typescript \
eslint-plugin-import@^2.20.1 \
@typescript-eslint/eslint-plugin@^2.24.0 \
@typescript-eslint/eslint-plugin@^3.1.0 \
--save-dev
```

Expand Down Expand Up @@ -74,7 +74,6 @@ It's recommended to alter your ESLint config for additional functionality. Here'
"extends": [
"airbnb-typescript",
"airbnb/hooks",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
Expand Down
49 changes: 45 additions & 4 deletions lib/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,47 @@ module.exports = {
'brace-style': 'off',
'@typescript-eslint/brace-style': baseStyleRules['brace-style'],

// Replace Airbnb 'camelcase' rule with '@typescript-eslint' version
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/camelcase.md
// Replace Airbnb 'camelcase' rule with '@typescript-eslint/naming-convention'
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
camelcase: 'off',
'@typescript-eslint/camelcase': baseStyleRules.camelcase,

'@typescript-eslint/naming-convention': [
'error',
// The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
{
selector: 'default',
format: ['camelCase'],
},
// Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript recommendations, we are assuming this rule would similarly apply to anything "type like", including interfaces, type aliases, and enums.
{
selector: 'typeLike',
format: ['PascalCase'],
},
// Allow UPPER_CASE for variables to cater for 23.10
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
},
// Allow any naming convention for properties, because (1) Airbnb does not specify any naming conventions for properties (2) The `camelcase` rule specifically disables checking properties: https://github.com/airbnb/javascript/blob/06b3ab11d9a443ff46f052dd00375e271e5146e6/packages/eslint-config-airbnb-base/rules/style.js#L24
{
selector: 'property',
format: null,
},
// Allow any naming convention for enum members, because Airbnb has no recommendation
{
selector: 'enumMember',
format: null,
},
],
// Replace Airbnb 'comma-spacing' rule with '@typescript-eslint' version
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
'comma-spacing': 'off',
'@typescript-eslint/comma-spacing': baseStyleRules['comma-spacing'],

// Replace Airbnb 'dot-notation' rule with '@typescript-eslint' version
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
'dot-notation': 'off',
'@typescript-eslint/dot-notation': baseBestPracticesRules['dot-notation'],

// Replace Airbnb 'func-call-spacing' rule with '@typescript-eslint' version
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
'func-call-spacing': 'off',
Expand All @@ -48,6 +79,16 @@ module.exports = {
indent: 'off',
'@typescript-eslint/indent': baseStyleRules.indent,

// Replace Airbnb 'keyword-spacing' rule with '@typescript-eslint' version
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
'keyword-spacing': 'off',
'@typescript-eslint/keyword-spacing': baseStyleRules['keyword-spacing'],

// Replace Airbnb 'lines-between-class-members' rule with '@typescript-eslint' version
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': baseStyleRules['lines-between-class-members'],

// Replace Airbnb 'no-array-constructor' rule with '@typescript-eslint' version
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
'no-array-constructor': 'off',
Expand Down
94 changes: 42 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"validate": "npm run lint"
},
"dependencies": {
"@typescript-eslint/parser": "^2.24.0",
"@typescript-eslint/parser": "^3.1.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-airbnb-base": "^14.1.0"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^2.24.0"
"@typescript-eslint/eslint-plugin": "^3.1.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "2.27.0",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"doctoc": "1.4.0",
"eslint": "6.8.0",
"eslint-config-prettier": "6.11.0",
Expand Down

0 comments on commit 51229f9

Please sign in to comment.