diff --git a/InReach.code-workspace b/InReach.code-workspace index dfc1c5ebed..d932e9b9bb 100644 --- a/InReach.code-workspace +++ b/InReach.code-workspace @@ -137,6 +137,8 @@ "eslint.options": { "cache": true }, + "eslint.ignoreUntitled": true, + "eslint.nodeEnv": "development", "eslint.rules.customizations": [ { "rule": "import/order", @@ -160,9 +162,7 @@ }, { "rule": "sort-imports", "severity": "off" } ], - "eslint.runtime": "node", "eslint.useESLintClass": true, - "eslint.workingDirectories": [{ "pattern": "./packages/*/" }, { "pattern": "./apps/*/" }], "explorer.decorations.badges": true, "explorer.expandSingleFolderWorkspaces": false, "explorer.fileNesting.enabled": true, diff --git a/package.json b/package.json index 69a8d3eb1c..2ccf930cac 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "chokidar": ">=3.0.0", "csstype": "^3.1.2", "eslint-plugin-import": "npm:eslint-plugin-i@latest", + "eslint-plugin-node": "npm:eslint-plugin-n@latest", "glob-parent@<5.1.2": "^5.1.2", "http-cache-semantics@<=4.1.0": "^4.1.1", "listr2@<5": "^5.0.5", @@ -91,7 +92,6 @@ }, "patchedDependencies": { "@crowdin/ota-client@1.0.0": "patches/@crowdin__ota-client@1.0.0.patch", - "eslint-plugin-node@11.1.0": "patches/eslint-plugin-node@11.1.0.patch", "iso-google-locales@3.0.4": "patches/iso-google-locales@3.0.4.patch", "trpc-panel@1.3.4": "patches/trpc-panel@1.3.4.patch" }, diff --git a/packages/config/tsconfig/base.json b/packages/config/tsconfig/base.json index 97519a9275..8b042c2e75 100644 --- a/packages/config/tsconfig/base.json +++ b/packages/config/tsconfig/base.json @@ -17,7 +17,7 @@ "resolveJsonModule": true, "skipLibCheck": true, "strict": true, - "target": "es2017" + "target": "es2020" }, "display": "Default", "include": ["../../@types/**/*.ts"], diff --git a/packages/eslint-config/base.js b/packages/eslint-config/base.js index 77928b322c..27e40fa271 100644 --- a/packages/eslint-config/base.js +++ b/packages/eslint-config/base.js @@ -1,4 +1,3 @@ -/* eslint-disable import/no-unused-modules */ /** @type {import('eslint').ESLint.ConfigData} */ const config = { plugins: ['codegen', 'turbo', 'node', /*'import',*/ '@tanstack/query'], @@ -12,6 +11,10 @@ const config = { 'prettier', ], rules: { + '@typescript-eslint/consistent-type-assertions': [ + 'error', + { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow-as-parameter' }, + ], '@typescript-eslint/consistent-type-imports': [ 'error', { @@ -32,7 +35,11 @@ const config = { ], '@typescript-eslint/no-empty-function': 'off', 'no-duplicate-imports': 'off', + 'node/no-deprecated-api': 'error', 'node/no-process-env': 'warn', + 'node/no-unsupported-features/es-builtins': 'error', + 'node/no-unsupported-features/es-syntax': 'error', + 'node/no-unsupported-features/node-builtins': 'error', 'codegen/codegen': 'error', 'react/jsx-key': 'off', 'react/no-unescaped-entities': 'off', @@ -103,21 +110,28 @@ const config = { ], parser: '@typescript-eslint/parser', parserOptions: { - project: ['./packages/*/tsconfig.json', './apps/*/tsconfig.json', './tsconfig.json'], + EXPERIMENTAL_useProjectService: true, + // project: [ './packages/*/tsconfig.json', './apps/*/tsconfig.json', './tsconfig.json' ], + emitDecoratorMetadata: true, + ecmaVersion: 2020, }, ignorePatterns: ['!.*', 'node_modules', 'dist/', '.next/'], settings: { + 'import/cache': { + lifetime: 60, + }, 'import/extensions': ['.js', '.jsx', '.cjs', '.mjs', '.ts', '.mts', '.tsx'], + 'import/internal-regex': '^(?:(?:@weareinreach\\/)|(?:~\\w*\\/)).*', + 'import/parsers': { + '@typescript-eslint/parser': ['.ts', '.tsx', '.mts'], + }, 'import/resolver': { node: true, typescript: { alwaysTryTypes: true, + project: ['./packages/*/tsconfig.json', './apps/*/tsconfig.json', './tsconfig.json'], }, }, - 'import/cache': { - lifetime: 10, - }, - 'import/internal-regex': '^(?:(?:@weareinreach\\/)|(?:~\\w*\\/)).*', }, env: { node: true, diff --git a/patches/eslint-plugin-node@11.1.0.patch b/patches/eslint-plugin-node@11.1.0.patch deleted file mode 100644 index 89d0492f73..0000000000 --- a/patches/eslint-plugin-node@11.1.0.patch +++ /dev/null @@ -1,81 +0,0 @@ -diff --git a/lib/rules/no-process-env.js b/lib/rules/no-process-env.js -index f46f00ec06b6bc870588579a5a8a7bd82c06eaea..5226a1e44c805b7542c70c592dd076d5ab53f251 100644 ---- a/lib/rules/no-process-env.js -+++ b/lib/rules/no-process-env.js -@@ -2,44 +2,44 @@ - * @author Vignesh Anand - * See LICENSE file in root directory for full license. - */ --"use strict" -+'use strict' - - //------------------------------------------------------------------------------ - // Rule Definition - //------------------------------------------------------------------------------ - - module.exports = { -- meta: { -- type: "suggestion", -- docs: { -- description: "disallow the use of `process.env`", -- category: "Stylistic Issues", -- recommended: false, -- url: -- "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-process-env.md", -- }, -- fixable: null, -- schema: [], -- messages: { -- unexpectedProcessEnv: "Unexpected use of process.env.", -- }, -- }, -+ meta: { -+ type: 'suggestion', -+ docs: { -+ description: 'disallow the use of `process.env`', -+ category: 'Stylistic Issues', -+ recommended: false, -+ url: 'https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-process-env.md', -+ }, -+ fixable: null, -+ schema: [], -+ messages: { -+ unexpectedProcessEnv: -+ "Do not use 'process.env' - use the 'env' object from @weareinreach/config.", -+ }, -+ }, - -- create(context) { -- return { -- MemberExpression(node) { -- const objectName = node.object.name -- const propertyName = node.property.name -+ create(context) { -+ return { -+ MemberExpression(node) { -+ const objectName = node.object.name -+ const propertyName = node.property.name - -- if ( -- objectName === "process" && -- !node.computed && -- propertyName && -- propertyName === "env" -- ) { -- context.report({ node, messageId: "unexpectedProcessEnv" }) -- } -- }, -- } -- }, -+ if ( -+ objectName === 'process' && -+ !node.computed && -+ propertyName && -+ propertyName === 'env' -+ ) { -+ context.report({ node, messageId: 'unexpectedProcessEnv' }) -+ } -+ }, -+ } -+ }, - } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e345f1352c..19d7bf56b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,7 @@ overrides: chokidar: '>=3.0.0' csstype: ^3.1.2 eslint-plugin-import: npm:eslint-plugin-i@latest + eslint-plugin-node: npm:eslint-plugin-n@latest glob-parent@<5.1.2: ^5.1.2 http-cache-semantics@<=4.1.0: ^4.1.1 listr2@<5: ^5.0.5 @@ -32,9 +33,6 @@ patchedDependencies: '@crowdin/ota-client@1.0.0': hash: refrge56ym5gomc3tkglzjdymy path: patches/@crowdin__ota-client@1.0.0.patch - eslint-plugin-node@11.1.0: - hash: 45p4dc3r2kwi3h2jyimmny42ju - path: patches/eslint-plugin-node@11.1.0.patch iso-google-locales@3.0.4: hash: ltnamflm7ayajalculwqyezjya path: patches/iso-google-locales@3.0.4.patch @@ -1346,8 +1344,8 @@ importers: specifier: npm:eslint-plugin-i@latest version: /eslint-plugin-i@2.28.0-2(@typescript-eslint/parser@6.4.0)(eslint-import-resolver-typescript@3.6.0)(eslint@8.47.0) eslint-plugin-node: - specifier: 11.1.0 - version: 11.1.0(patch_hash=45p4dc3r2kwi3h2jyimmny42ju)(eslint@8.47.0) + specifier: npm:eslint-plugin-n@latest + version: /eslint-plugin-n@16.0.1(eslint@8.47.0) eslint-plugin-react: specifier: 7.33.2 version: 7.33.2(eslint@8.47.0) @@ -12653,7 +12651,6 @@ packages: resolution: {integrity: sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==} dependencies: semver: 7.5.4 - dev: false /bundle-name@3.0.0: resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==} @@ -14664,15 +14661,15 @@ packages: - supports-color dev: true - /eslint-plugin-es@3.0.1(eslint@8.47.0): - resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} - engines: {node: '>=8.10.0'} + /eslint-plugin-es-x@7.2.0(eslint@8.47.0): + resolution: {integrity: sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==} + engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: - eslint: '>=4.19.1' + eslint: '>=8' dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.47.0) + '@eslint-community/regexpp': 4.6.2 eslint: 8.47.0 - eslint-utils: 2.1.0 - regexpp: 3.2.0 dev: true /eslint-plugin-i18next@6.0.3: @@ -14731,21 +14728,22 @@ packages: semver: 6.3.1 dev: true - /eslint-plugin-node@11.1.0(patch_hash=45p4dc3r2kwi3h2jyimmny42ju)(eslint@8.47.0): - resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} - engines: {node: '>=8.10.0'} + /eslint-plugin-n@16.0.1(eslint@8.47.0): + resolution: {integrity: sha512-CDmHegJN0OF3L5cz5tATH84RPQm9kG+Yx39wIqIwPR2C0uhBGMWfbbOtetR83PQjjidA5aXMu+LEFw1jaSwvTA==} + engines: {node: '>=16.0.0'} peerDependencies: - eslint: '>=5.16.0' + eslint: '>=7.0.0' dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.47.0) + builtins: 5.0.1 eslint: 8.47.0 - eslint-plugin-es: 3.0.1(eslint@8.47.0) - eslint-utils: 2.1.0 + eslint-plugin-es-x: 7.2.0(eslint@8.47.0) ignore: 5.2.4 + is-core-module: 2.13.0 minimatch: 3.1.2 resolve: 1.22.4 - semver: 6.3.1 + semver: 7.5.4 dev: true - patched: true /eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705(eslint@8.47.0): resolution: {integrity: sha512-AZYbMo/NW9chdL7vk6HQzQhT+PvTAEVqWk9ziruUoW2kAOcN5qNyelv70e0F1VNQAbvutOC9oc+xfWycI9FxDw==} @@ -14826,18 +14824,6 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils@2.1.0: - resolution: {integrity: sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==} - engines: {node: '>=6'} - dependencies: - eslint-visitor-keys: 1.3.0 - dev: true - - /eslint-visitor-keys@1.3.0: - resolution: {integrity: sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==} - engines: {node: '>=4'} - dev: true - /eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -22172,11 +22158,6 @@ packages: define-properties: 1.2.0 functions-have-names: 1.2.3 - /regexpp@3.2.0: - resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} - engines: {node: '>=8'} - dev: true - /regexpu-core@5.3.2: resolution: {integrity: sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==} engines: {node: '>=4'}