Skip to content
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 rules #230

Merged
merged 5 commits into from Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions .eslintrc.js
Expand Up @@ -178,6 +178,12 @@ module.exports = {
'node/no-mixed-requires': 2,
// Using path.join() is often not needed when using only core Node.js APIs
'node/no-path-concat': 0,
'node/no-unsupported-features/es-syntax': [
'error',
{
ignores: ['modules'],
},
],
// Browser globals should not use `require()`. Non-browser globals should
'node/prefer-global/console': 2,
'node/prefer-global/buffer': [2, 'never'],
Expand Down Expand Up @@ -299,6 +305,15 @@ module.exports = {
'import/no-extraneous-dependencies': 0,
},
},
// TypeScript-specific settings.
{
files: ['*.ts', '*.tsx'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
},
{
// ES modules
files: ['*.mjs'],
Expand All @@ -311,6 +326,20 @@ module.exports = {
},
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.d.ts', '.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true,
},
},
node: {
tryExtensions: ['.js', '.ts', '.d.ts'],
},
react: {
version: '16.13.1',
},
Expand Down