From 1318102892be29ccc57afc32312130f9d79f9147 Mon Sep 17 00:00:00 2001 From: Karl Horky Date: Wed, 19 Jul 2023 12:15:51 +0200 Subject: [PATCH] Switch `moduleResolution` to `Bundler` Next.js also recently changed their default `moduleResolution` from `Node` to `Bundler`: - https://github.com/vercel/next.js/pull/51957 More background: - https://github.com/typescript-eslint/typescript-eslint/issues/7213#issuecomment-1641092797 - https://github.com/typescript-eslint/typescript-eslint/issues/7185#issuecomment-1631374643 --- .eslintrc.cjs | 2 +- index.cjs | 6 +++--- templates/.eslintrc.cjs | 2 +- tsconfig.base.json | 8 ++++---- tsconfig.json | 4 +++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 6a02519..6ee35d9 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,4 +1,4 @@ -/** @type {import('@typescript-eslint/utils/dist').TSESLint.Linter.Config} */ +/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */ const config = { extends: ['upleveled'], }; diff --git a/index.cjs b/index.cjs index 9c4f971..5746d98 100644 --- a/index.cjs +++ b/index.cjs @@ -1,4 +1,4 @@ -/** @type {import('@typescript-eslint/utils/dist').TSESLint.Linter.RuleLevelAndOptions} */ +/** @type {import('@typescript-eslint/utils').TSESLint.Linter.RuleLevelAndOptions} */ const noRestrictedSyntaxOptions = [ 'warn', // Currently it is not possible to use Markdown eg. links in ESLint warnings / error messages @@ -192,7 +192,7 @@ Prefer an if...else statement like this: * https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js * https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/base.js * - * @type {import('@typescript-eslint/utils/dist').TSESLint.Linter.Config['rules']} + * @type {import('@typescript-eslint/utils').TSESLint.Linter.Config['rules']} */ const eslintConfigReactAppRules = { 'array-callback-return': 'warn', @@ -419,7 +419,7 @@ const eslintConfigReactAppRules = { 'react-hooks/rules-of-hooks': 'error', }; -/** @type {import('@typescript-eslint/utils/dist').TSESLint.Linter.Config} */ +/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */ const config = { root: true, parser: '@typescript-eslint/parser', diff --git a/templates/.eslintrc.cjs b/templates/.eslintrc.cjs index 6a02519..6ee35d9 100644 --- a/templates/.eslintrc.cjs +++ b/templates/.eslintrc.cjs @@ -1,4 +1,4 @@ -/** @type {import('@typescript-eslint/utils/dist').TSESLint.Linter.Config} */ +/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */ const config = { extends: ['upleveled'], }; diff --git a/tsconfig.base.json b/tsconfig.base.json index 84ae401..8f8de3e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -2,10 +2,10 @@ "$schema": "https://json.schemastore.org/tsconfig", "display": "UpLeveled Node + React TSConfig", "compilerOptions": { - "lib": ["dom", "dom.iterable", "esnext"], - "module": "esnext", - "target": "es2015", - "moduleResolution": "node", + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "module": "ESNext", + "target": "ES2015", + "moduleResolution": "Bundler", "resolveJsonModule": true, "esModuleInterop": true, "isolatedModules": true, diff --git a/tsconfig.json b/tsconfig.json index 6ac5aa0..58cb85d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,9 @@ "extends": "./tsconfig.base.json", "compilerOptions": { "checkJs": true, - "target": "esnext" + "target": "ESNext", + "module": "Node16", + "moduleResolution": "Node16" }, "include": [ "**/.eslintrc.cjs",