Skip to content

Commit

Permalink
Update typescript-eslint and other dependencies to support optional c…
Browse files Browse the repository at this point in the history
…haining
  • Loading branch information
iansu committed Nov 25, 2019
1 parent fa4da1e commit aa36a89
Show file tree
Hide file tree
Showing 5 changed files with 304 additions and 368 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0 (November 24, 2019)

- Update `@typescript-eslint` and other dependencies to support optional chaining

## 0.4.2 (November 4, 2019)

- Disable `require-atomic-updates` rule
Expand Down
2 changes: 1 addition & 1 deletion config-frontend.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: ['./index.js', 'plugin:node/recommended', 'plugin:react/recommended'],
extends: ['./index.js', 'plugin:react/recommended'],
plugins: ['node', 'react', 'react-hooks'],
env: {
browser: true
Expand Down
110 changes: 68 additions & 42 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,68 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:node/recommended',
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:unicorn/recommended',
'plugin:import/typescript',
'plugin:promise/recommended',
'prettier',
'prettier/@typescript-eslint'
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'node', 'jest', 'unicorn', 'promise', 'import'],
env: {
es6: true,
'jest/globals': true
},
plugins: ['node', 'jest', 'unicorn', 'promise', 'import'],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module'
},
env: {
es6: true,
'jest/globals': true
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
extends: ['plugin:@typescript-eslint/recommended', 'prettier/@typescript-eslint'],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: true
},
// if adding a typescript-eslint version of an existing ESLint rule make sure to disable the ESLint rule here
rules: {
// 'tsc' already handles this: https://github.com/typescript-eslint/typescript-eslint/issues/291
'no-dupe-class-members': 'off',
// 'tsc' already handles this: https://github.com/typescript-eslint/typescript-eslint/issues/477
'no-undef': 'off',
'no-array-constructor': 'off',

'@typescript-eslint/consistent-type-assertions': 'warn',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-array-constructor': 'warn',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_+' }],
// enable this once typescript-eslint 2.9.0 is released
// '@typescript-eslint/prefer-optional-chain': 'warn'

// disabled for performance reasons for now, rules that require type information are very slow
// '@typescript-eslint/promise-function-async': [
// "error",
// {
// "checkArrowFunctions": true,
// "checkFunctionDeclarations": true,
// "checkFunctionExpressions": true,
// "checkMethodDeclarations": true
// }
// ],
}
},
{
files: ['**/test/**/*'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off'
}
}
],
rules: {
eqeqeq: ['error', 'smart'],
'func-names': ['warn', 'as-needed'],
Expand All @@ -42,27 +84,22 @@ module.exports = {
'no-use-before-define': ['error', 'nofunc'],
'no-useless-concat': 'warn',
'no-var': 'warn',
'padding-line-between-statements': ['warn', { blankLine: 'always', prev: '*', next: 'return' }],
'padding-line-between-statements': [
'warn',
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: '*', next: 'throw' },
{ blankLine: 'always', prev: '*', next: 'block-like' },
{ blankLine: 'always', prev: 'block-like', next: '*' },
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'always', prev: '*', next: ['const', 'let', 'var'] },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] }
],
'prefer-const': 'warn',
'prefer-template': 'warn',
// disable atomic updates rule until this issue is resolved: https://github.com/eslint/eslint/issues/11899
'require-atomic-updates': 'off',
'require-await': 'off',

'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_+' }],
'@typescript-eslint/explicit-function-return-type': 'error',

// disabled for performance reasons for now, rules that require type information are very slow
// '@typescript-eslint/promise-function-async': [
// "error",
// {
// "checkArrowFunctions": true,
// "checkFunctionDeclarations": true,
// "checkFunctionExpressions": true,
// "checkMethodDeclarations": true
// }
// ],

'node/exports-style': 'error',
'node/no-unpublished-import': 'off',
'node/no-missing-import': 'off',
Expand Down Expand Up @@ -92,24 +129,13 @@ module.exports = {
'import/order': [
'warn',
{
groups: [['builtin', 'external'], ['sibling', 'parent']],
groups: [
['builtin', 'external'],
['sibling', 'parent']
],
'newlines-between': 'always-and-inside-groups'
}
],
'import/newline-after-import': ['warn']
},
overrides: [
{
files: ['*.js', '*.jsx'],
rules: {
'@typescript-eslint/no-var-requires': 'off'
}
},
{
files: ['**/test/**/*'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off'
}
}
]
'import/newline-after-import': 'warn'
}
};
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-neo",
"version": "0.4.2",
"version": "0.5.0",
"description": "Official Neo Financial ESLint configuration",
"main": "index.js",
"author": "Neo Financial Engineering <[email protected]>",
Expand All @@ -14,23 +14,25 @@
"*.js"
],
"peerDependencies": {
"eslint": "^5.0.0 || ^6.0.0",
"prettier": "^1.16.0"
"eslint": "^6.0.0",
"prettier": "^1.19.0",
"typescript": "^3.7.0"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^2.4.0",
"@typescript-eslint/parser": "^2.4.0",
"eslint-config-prettier": "^6.4.0",
"@typescript-eslint/eslint-plugin": "^2.8.0",
"@typescript-eslint/parser": "^2.8.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.19.0",
"eslint-plugin-jest": "^23.0.4",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^2.1.2",
"eslint-plugin-unicorn": "^12.1.0"
"eslint-plugin-react-hooks": "^2.3.0",
"eslint-plugin-unicorn": "^13.0.0"
},
"devDependencies": {
"eslint": "^6.5.1",
"prettier": "^1.18.2"
"eslint": "^6.7.0",
"prettier": "^1.19.1",
"typescript": "^3.7.2"
}
}
Loading

0 comments on commit aa36a89

Please sign in to comment.