New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add TypeScript support #106
Changes from 3 commits
552d174
67140e7
015b006
d0400a5
69c55bf
3d0bdfe
457be86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// eslint-disable-next-line import/no-commonjs | ||
module.exports = { | ||
plugins: ['@typescript-eslint'], | ||
rules: { | ||
'@typescript-eslint/adjacent-overload-signatures': ['error'], | ||
'@typescript-eslint/array-type': ['error', 'array-simple'], | ||
'@typescript-eslint/ban-types': ['error'], | ||
'@typescript-eslint/ban-ts-ignore': ['off'], | ||
'@typescript-eslint/camelcase': ['error'], | ||
'@typescript-eslint/class-name-casing': ['error'], | ||
'@typescript-eslint/explicit-function-return-type': ['off'], | ||
'@typescript-eslint/explicit-member-accessibility': ['error'], | ||
'@typescript-eslint/generic-type-naming': ['off'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to enable it to force the usage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No objection on this. There will be 10 errors to fix in InstantSearch.js, I'll need a little help to fix them but nothing insurmountable. |
||
'@typescript-eslint/indent': ['off'], | ||
'@typescript-eslint/interface-name-prefix': ['error', 'never'], | ||
'@typescript-eslint/member-delimiter-style': ['off'], | ||
'@typescript-eslint/member-naming': ['off'], | ||
'@typescript-eslint/member-ordering': [ | ||
'error', | ||
{ | ||
default: ['static-field'], | ||
}, | ||
], | ||
'@typescript-eslint/no-angle-bracket-type-assertion': ['error'], | ||
'@typescript-eslint/no-array-constructor': ['error'], | ||
'@typescript-eslint/no-empty-interface': ['error'], | ||
'@typescript-eslint/no-explicit-any': ['off'], | ||
'@typescript-eslint/no-extraneous-class': ['off'], | ||
'@typescript-eslint/no-for-in-array': ['off'], | ||
'@typescript-eslint/no-inferrable-types': ['off'], | ||
'@typescript-eslint/no-misused-new': ['error'], | ||
'@typescript-eslint/no-namespace': ['error'], | ||
'@typescript-eslint/no-non-null-assertion': ['off'], | ||
'@typescript-eslint/no-object-literal-type-assertion': ['off'], | ||
'@typescript-eslint/no-parameter-properties': ['off'], | ||
'@typescript-eslint/no-require-imports': ['off'], | ||
'@typescript-eslint/no-this-alias': ['off'], | ||
'@typescript-eslint/no-triple-slash-reference': ['error'], | ||
'@typescript-eslint/no-type-alias': ['off'], | ||
'@typescript-eslint/no-unnecessary-qualifier': ['off'], | ||
'@typescript-eslint/no-unnecessary-type-assertion': ['off'], | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
'@typescript-eslint/no-use-before-define': ['error', { functions: false }], | ||
'@typescript-eslint/no-useless-constructor': ['error'], | ||
'@typescript-eslint/no-var-requires': ['error'], | ||
'@typescript-eslint/prefer-for-of': ['off'], | ||
'@typescript-eslint/prefer-function-type': ['error'], | ||
'@typescript-eslint/prefer-interface': ['off'], | ||
'@typescript-eslint/prefer-namespace-keyword': ['error'], | ||
'@typescript-eslint/promise-function-async': ['off'], | ||
'@typescript-eslint/restrict-plus-operands': ['off'], | ||
'@typescript-eslint/type-annotation-spacing': ['error'], | ||
'@typescript-eslint/unbound-method': ['off'], | ||
'@typescript-eslint/unified-signatures': ['error'], | ||
|
||
// Disable rules superset by @typescript-eslint | ||
'no-unused-vars': ['off'], | ||
'no-use-before-define': ['off'], | ||
camelcase: ['off'], | ||
'no-array-constructor': ['off'], | ||
'no-useless-constructor': ['off'], | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// eslint-disable-next-line import/no-commonjs | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
impliedStrict: true, | ||
jsx: true, | ||
}, | ||
}, | ||
extends: [ | ||
'./base.js', | ||
'./rules/typescript.js', | ||
'prettier/@typescript-eslint', | ||
], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on our usage but it might be interesting to enable it with both option enable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objection on this but it will add a little more work to type our code. There will be 7 errors to fix in InstantSearch.js but it should not be too difficult.