Skip to content

Commit 0cfc751

Browse files
authored
Only check import resolution on typed linting (#1352)
Otherwise, the ESM import rules are applied, which are not applicable to TS files (extensions are ommitted in TS).
1 parent aef909a commit 0cfc751

5 files changed

Lines changed: 3 additions & 44 deletions

File tree

e2e/browser/test/e2e.playwright.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919
//
2020

21-
// We are using a typescript path but lint is not picking this up.
22-
// eslint-disable-next-line import/no-unresolved
2321
import { test, expect } from "@/packages/internal-playwright-helpers";
2422

2523
test("creating and removing empty Containers", async ({ page, auth }) => {

e2e/browser/test/globalSetup.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919
//
2020

21-
// We are using a typescript path but lint is not picking this up.
22-
// eslint-disable-next-line import/no-unresolved
2321
import { setupEnv } from "@/packages/internal-test-env";
2422

2523
async function globalSetup() {

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import inruptCfg from "@inrupt/eslint-config-base";
2222
import next from "@next/eslint-plugin-next";
2323

24-
// eslint-disable-next-line import/no-unresolved
2524
import { defineConfig } from "eslint/config";
2625

2726
export default defineConfig([

packages/eslint-config/index.js

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import js from "@eslint/js";
2222
import json from "@eslint/json";
2323
import markdown from "@eslint/markdown";
2424

25-
// eslint-disable-next-line import/no-unresolved
2625
import { defineConfig, globalIgnores } from "eslint/config";
2726
import importPlugin from "eslint-plugin-import";
2827
import jest from "eslint-plugin-jest";
@@ -31,7 +30,6 @@ import prettier from "eslint-plugin-prettier/recommended";
3130
import react from "eslint-plugin-react";
3231
import hooks from "eslint-plugin-react-hooks";
3332
import globals from "globals";
34-
// eslint-disable-next-line import/no-unresolved
3533
import tseslint from "typescript-eslint";
3634

3735
const typedLinting = {
@@ -82,42 +80,7 @@ export default defineConfig([
8280
},
8381
// TS config
8482
...tseslint.configs.recommended,
85-
importPlugin.flatConfigs.recommended,
86-
{
87-
languageOptions: {
88-
parserOptions: {
89-
projectService: true,
90-
tsconfigRootDir: import.meta.dirname,
91-
},
92-
},
93-
rules: {
94-
"@typescript-eslint/no-floating-promises": "error",
95-
"@typescript-eslint/no-empty-function": [
96-
"error",
97-
{
98-
allow: ["arrowFunctions"],
99-
},
100-
],
101-
"@typescript-eslint/consistent-type-imports": [
102-
"error",
103-
{
104-
prefer: "type-imports",
105-
},
106-
],
107-
"@typescript-eslint/return-await": ["error", "in-try-catch"],
108-
},
109-
// Lint imports based on TS module resolution.
110-
extends: [importPlugin.flatConfigs.typescript],
111-
files: ["**/*.ts", "**/*.tsx"],
112-
// This avoids requiring a dedicated tsconfig.eslint.json file in every repo.
113-
ignores: [
114-
"**/*.test.ts",
115-
"**/*.mock*.ts",
116-
"**/jest.setup.ts",
117-
"**/e2e.playwright.ts",
118-
"**/globalSetup.ts",
119-
],
120-
},
83+
typedLinting,
12184
// React config
12285
{
12386
plugins: {
@@ -218,6 +181,7 @@ export default defineConfig([
218181

219182
export const ignoreTypedLinting = (paths) => {
220183
paths.forEach((path) => {
184+
console.log("Ignoring " + path);
221185
typedLinting.ignores.push(path);
222186
});
223187
};

packages/jest-jsdom-polyfills/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919
//
2020

21-
/* eslint-disable @typescript-eslint/no-require-imports,no-undef */
21+
/* eslint-disable @typescript-eslint/no-require-imports */
2222

2323
// TextEncoder / TextDecoder APIs are used by Jose, but are not provided by
2424
// jsdom, all node versions supported provide these via the util module

0 commit comments

Comments
 (0)