Skip to content

Commit f995360

Browse files
eduardoboucasnetlify-team-account-1ascorbic
authored
feat: add TypeScript rules (#230)
* feat: add TypeScript rules * feat: install eslint-import-resolver-typescript to support .modified #230 (comment) * lint .tsx files Co-authored-by: Matt Kane <matt.kane@netlify.com> Co-authored-by: Netlify Team Account 1 <netlify-team-account-1@users.noreply.github.com> Co-authored-by: Netlify Team Account 1 <90322326+netlify-team-account-1@users.noreply.github.com> Co-authored-by: Matt Kane <matt.kane@netlify.com>
1 parent f10050b commit f995360

File tree

3 files changed

+464
-73
lines changed

3 files changed

+464
-73
lines changed

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ module.exports = {
178178
'node/no-mixed-requires': 2,
179179
// Using path.join() is often not needed when using only core Node.js APIs
180180
'node/no-path-concat': 0,
181+
'node/no-unsupported-features/es-syntax': [
182+
'error',
183+
{
184+
ignores: ['modules'],
185+
},
186+
],
181187
// Browser globals should not use `require()`. Non-browser globals should
182188
'node/prefer-global/console': 2,
183189
'node/prefer-global/buffer': [2, 'never'],
@@ -299,6 +305,15 @@ module.exports = {
299305
'import/no-extraneous-dependencies': 0,
300306
},
301307
},
308+
// TypeScript-specific settings.
309+
{
310+
files: ['*.ts', '*.tsx'],
311+
extends: [
312+
'plugin:@typescript-eslint/eslint-recommended',
313+
'plugin:@typescript-eslint/recommended',
314+
'plugin:import/typescript',
315+
],
316+
},
302317
{
303318
// ES modules
304319
files: ['*.mjs'],
@@ -311,6 +326,20 @@ module.exports = {
311326
},
312327
],
313328
settings: {
329+
'import/parsers': {
330+
'@typescript-eslint/parser': ['.ts', '.tsx'],
331+
},
332+
'import/resolver': {
333+
node: {
334+
extensions: ['.js', '.jsx', '.d.ts', '.ts', '.tsx'],
335+
},
336+
typescript: {
337+
alwaysTryTypes: true,
338+
},
339+
},
340+
node: {
341+
tryExtensions: ['.js', '.ts', '.d.ts'],
342+
},
314343
react: {
315344
version: '16.13.1',
316345
},

0 commit comments

Comments
 (0)