From 862d98d1f71569ae35d0783d03d107cd2a12f679 Mon Sep 17 00:00:00 2001 From: Adam Butterfield Date: Sat, 8 Jul 2023 23:26:51 +0900 Subject: [PATCH] Restore 2 eslint configs --- .eslintignore | 1 + .eslintrc.js | 33 +++------------------------------ src/.eslintrc.js | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 30 deletions(-) create mode 100644 .eslintignore create mode 100644 src/.eslintrc.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..be3973a --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +src/.eslintrc.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index b224021..f518009 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,36 +1,9 @@ /** @type {import('eslint').Linter.Config} */ module.exports = { - ignorePatterns: '.eslintrc.js', - parser: '@typescript-eslint/parser', + extends: ['eslint/recommended', 'prettier'], parserOptions: { - project: ['./tsconfig.json', './tsconfig.jest.json'], - tsconfigRootDir: __dirname, + ecmaVersion: 2015, + sourceType: 'module', }, - settings: { - 'import/parsers': { - '@typescript-eslint/parser': ['.ts', '.tsx'], - }, - 'import/resolver': { - // use /tsconfig.json - typescript: { - alwaysTryTypes: true, // always try to resolve types under `@types` directory even it doesn't contain any source code, like `@types/unist` - }, - }, - }, - extends: [ - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - 'react-app', - 'plugin:prettier/recommended', - ], - overrides: [ - { - files: ['**/*.test.ts', '**/*.test.tsx'], - rules: { - '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }], - }, - }, - ], }; diff --git a/src/.eslintrc.js b/src/.eslintrc.js new file mode 100644 index 0000000..97e6c37 --- /dev/null +++ b/src/.eslintrc.js @@ -0,0 +1,35 @@ +/** @type {import('eslint').Linter.Config} */ + +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + project: ['../tsconfig.json', '../tsconfig.jest.json'], + tsconfigRootDir: __dirname, + }, + settings: { + 'import/parsers': { + '@typescript-eslint/parser': ['.ts', '.tsx'], + }, + 'import/resolver': { + // use /tsconfig.json + typescript: { + alwaysTryTypes: true, // always try to resolve types under `@types` directory even it doesn't contain any source code, like `@types/unist` + }, + }, + }, + extends: [ + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'react-app', + 'prettier', + ], + overrides: [ + { + files: ['**/*.test.ts', '**/*.test.tsx'], + rules: { + '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }], + }, + }, + ], +};