From 50a5159add78394542122f923ba56a72a8479735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20G=C3=BCdelh=C3=B6fer?= Date: Tue, 23 Nov 2021 13:18:27 +0100 Subject: [PATCH 1/7] :sparkles: Add option to allow relative imports --- lib/rules/no-relative-imports.ts | 83 +++++++++++++++++---- tests/lib/rules/no-relative-imports.test.ts | 55 ++++++++++++-- 2 files changed, 119 insertions(+), 19 deletions(-) diff --git a/lib/rules/no-relative-imports.ts b/lib/rules/no-relative-imports.ts index 7f708cd..359b5a5 100644 --- a/lib/rules/no-relative-imports.ts +++ b/lib/rules/no-relative-imports.ts @@ -5,8 +5,9 @@ const creator = RuleCreator((rule) => rule) export type Options = { baseUrl?: string + allowLocalRelativeImports?: boolean }[] -export type MessageIds = "standard-message" +export type MessageIds = "no-relative-import" export default creator({ name: "no-relative-imports", meta: { @@ -17,8 +18,7 @@ export default creator({ }, fixable: "code", messages: { - "standard-message": - "No relative imports, that go to back to the baseURl", + "no-relative-import": "No relative imports", }, schema: [ { @@ -31,11 +31,23 @@ export default creator({ }, ], }, - defaultOptions: [], + defaultOptions: [ + { + allowLocalRelativeImports: false, + }, + ], create(context) { return { ImportDeclaration(node) { + // no relative import + if (!node.source.value.startsWith("..")) { + return + } + const fileName = context.getPhysicalFilename?.() + const options = context.options?.[0] ?? { + allowLocalRelativeImports: false, + } if (fileName == undefined) { console.error("Got no physical file name ?!") return @@ -43,17 +55,37 @@ export default creator({ const basePath = path.resolve( process.cwd(), - context.options?.[0]?.baseUrl ?? "." + options.baseUrl ?? "." ) - if (!fileName.startsWith(basePath)) { - return - } const relativeFileName = fileName.replace(basePath, "") const levels = relativeFileName.split("/").length - 2 const levelImport = "../".repeat(levels) - if (node.source.value.startsWith(levelImport)) { + const filePath = fileName.substring( + 0, + fileName.lastIndexOf("/") + ) + const nonRelativeImportPath = path.resolve( + filePath, + node.source.value + ) + const isInBasePath = filePath.startsWith(basePath) + const nonRelativeImportPathWithoutBase = + nonRelativeImportPath.replace(basePath + "/", "") + console.dir({ + isInBasePath, + nonRelativeImportPathWithoutBase, + filePath, + basePath, + nonRelativeImportPath, + levelImport, + original: node.source.value, + options, + }) + + // always remove imports that go past the base URL + if (node.source.value.startsWith(levelImport) && isInBasePath) { const withoutLevels = node.source.value.replace( levelImport, "" @@ -64,18 +96,43 @@ export default creator({ context.report({ node: node.source, - messageId: "standard-message", + messageId: "no-relative-import", data: {}, fix: (fixer) => { return fixer.replaceText( node.source, - '"' + - node.source.value.replace(levelImport, "") + - '"' + `"${nonRelativeImportPathWithoutBase}"` ) }, }) + return } + + // We report the error, if we disallow relative imports + // Or we cross INTO the baseUrl boundary + if ( + options.allowLocalRelativeImports && + !( + nonRelativeImportPath.startsWith(basePath) && + !filePath.startsWith(basePath) + ) + ) { + return + } + + context.report({ + node: node.source, + messageId: "no-relative-import", + data: {}, + fix: (fixer) => { + return fixer.replaceText( + node.source, + `"${nonRelativeImportPathWithoutBase}"` + ) + }, + }) + + return }, } }, diff --git a/tests/lib/rules/no-relative-imports.test.ts b/tests/lib/rules/no-relative-imports.test.ts index 0352c0b..569d195 100644 --- a/tests/lib/rules/no-relative-imports.test.ts +++ b/tests/lib/rules/no-relative-imports.test.ts @@ -15,34 +15,77 @@ spy.mockReturnValue("/") ruleTester.run("my-rule", noRelativeImports, { valid: [ { - options: [{ baseUrl: "./src" }], + options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], code: 'import {foo} from "bla/test"', filename: "/src/nested/deep/test.js", }, { - options: [{ baseUrl: "./src" }], + options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], code: 'import {foo} from "../../../bla/test"', filename: "/src/nested/deep/test.js", }, { - options: [{ baseUrl: "./src" }], + options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], code: 'import {foo} from "../bla/test"', filename: "/src/nested/deep/test.js", }, { - options: [{ baseUrl: "./src" }], + options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], code: 'import {foo} from "../../../bla/test"', filename: "/test/nested/deep/test.js", }, + { + options: [{ baseUrl: "./src" }], + code: 'import {foo} from "nested/bla/test"', + filename: "/src/nested/deep/test.js", + }, + { + options: [{ baseUrl: "./src" }], + code: 'import {foo} from "../../../bla/test"', + filename: "/src/nested/deep/test.js", + }, ], invalid: [ { - options: [{ baseUrl: "./src" }], + options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], code: 'import {foo} from "../../bla/test"', filename: "/src/nested/deep/test.js", errors: [ { - messageId: "standard-message", + messageId: "no-relative-import", + }, + ], + output: 'import {foo} from "bla/test"', + }, + { + options: [{ baseUrl: "./src" }], + code: 'import {foo} from "../bla/test"', + filename: "/src/nested/deep/test.js", + errors: [ + { + messageId: "no-relative-import", + }, + ], + output: 'import {foo} from "nested/bla/test"', + }, + { + options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], + code: 'import {foo} from "../../src/bla/test"', + filename: "/somewhere/else/test.js", + errors: [ + { + messageId: "no-relative-import", + }, + ], + output: 'import {foo} from "bla/test"', + }, + { + options: [{ baseUrl: "./src" }], + code: 'import {foo} from "../../src/bla/test"', + filename: "/somewhere/else/test.js", + errors: [ + { + messageId: "no-relative-import", }, ], output: 'import {foo} from "bla/test"', From 83ca2bf34ff37c31c85fd9653f42812f547cbaa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20G=C3=BCdelh=C3=B6fer?= Date: Tue, 23 Nov 2021 13:19:38 +0100 Subject: [PATCH 2/7] :fire: Remove debug code --- lib/rules/no-relative-imports.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/rules/no-relative-imports.ts b/lib/rules/no-relative-imports.ts index 359b5a5..3c15fbd 100644 --- a/lib/rules/no-relative-imports.ts +++ b/lib/rules/no-relative-imports.ts @@ -73,16 +73,6 @@ export default creator({ const isInBasePath = filePath.startsWith(basePath) const nonRelativeImportPathWithoutBase = nonRelativeImportPath.replace(basePath + "/", "") - console.dir({ - isInBasePath, - nonRelativeImportPathWithoutBase, - filePath, - basePath, - nonRelativeImportPath, - levelImport, - original: node.source.value, - options, - }) // always remove imports that go past the base URL if (node.source.value.startsWith(levelImport) && isInBasePath) { From 4565f850e970248b55e9c51beaee08321e026b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20G=C3=BCdelh=C3=B6fer?= Date: Tue, 23 Nov 2021 14:06:24 +0100 Subject: [PATCH 3/7] :ok_hand: --- lib/rules/no-relative-imports.ts | 53 ++++++----- tests/lib/rules/no-relative-imports.test.ts | 97 ++++++++++++++++++--- 2 files changed, 112 insertions(+), 38 deletions(-) diff --git a/lib/rules/no-relative-imports.ts b/lib/rules/no-relative-imports.ts index 3c15fbd..d9002a5 100644 --- a/lib/rules/no-relative-imports.ts +++ b/lib/rules/no-relative-imports.ts @@ -5,7 +5,7 @@ const creator = RuleCreator((rule) => rule) export type Options = { baseUrl?: string - allowLocalRelativeImports?: boolean + allowLocalImports?: "inside-base-path" | "local" }[] export type MessageIds = "no-relative-import" export default creator({ @@ -31,23 +31,28 @@ export default creator({ }, ], }, - defaultOptions: [ - { - allowLocalRelativeImports: false, - }, - ], + defaultOptions: [], create(context) { return { ImportDeclaration(node) { + const options = context.options?.[0] ?? {} + // no relative import - if (!node.source.value.startsWith("..")) { + if (!node.source.value.startsWith(".")) { return } - const fileName = context.getPhysicalFilename?.() - const options = context.options?.[0] ?? { - allowLocalRelativeImports: false, + if ( + options.allowLocalImports === "local" || + options.allowLocalImports === "inside-base-path" + ) { + // We start with a "./" followed by a different char, so it's a local import + if (/^\.\/[^.]/.test(node.source.value)) { + return + } } + + const fileName = context.getPhysicalFilename?.() if (fileName == undefined) { console.error("Got no physical file name ?!") return @@ -62,17 +67,20 @@ export default creator({ const levels = relativeFileName.split("/").length - 2 const levelImport = "../".repeat(levels) - const filePath = fileName.substring( - 0, - fileName.lastIndexOf("/") - ) - const nonRelativeImportPath = path.resolve( + const filePath = path.dirname(fileName) + + const absoluteImportPath = path.resolve( filePath, node.source.value ) const isInBasePath = filePath.startsWith(basePath) - const nonRelativeImportPathWithoutBase = - nonRelativeImportPath.replace(basePath + "/", "") + const absoluteImportPathWithoutBase = + absoluteImportPath.replace(basePath + "/", "") + + // we import something outside of the basePath + if (!absoluteImportPath.startsWith(basePath)) { + return + } // always remove imports that go past the base URL if (node.source.value.startsWith(levelImport) && isInBasePath) { @@ -91,7 +99,7 @@ export default creator({ fix: (fixer) => { return fixer.replaceText( node.source, - `"${nonRelativeImportPathWithoutBase}"` + `"${absoluteImportPathWithoutBase}"` ) }, }) @@ -101,11 +109,8 @@ export default creator({ // We report the error, if we disallow relative imports // Or we cross INTO the baseUrl boundary if ( - options.allowLocalRelativeImports && - !( - nonRelativeImportPath.startsWith(basePath) && - !filePath.startsWith(basePath) - ) + options.allowLocalImports == undefined && + !absoluteImportPath.startsWith(basePath) ) { return } @@ -117,7 +122,7 @@ export default creator({ fix: (fixer) => { return fixer.replaceText( node.source, - `"${nonRelativeImportPathWithoutBase}"` + `"${absoluteImportPathWithoutBase}"` ) }, }) diff --git a/tests/lib/rules/no-relative-imports.test.ts b/tests/lib/rules/no-relative-imports.test.ts index 569d195..1ec7acb 100644 --- a/tests/lib/rules/no-relative-imports.test.ts +++ b/tests/lib/rules/no-relative-imports.test.ts @@ -15,22 +15,43 @@ spy.mockReturnValue("/") ruleTester.run("my-rule", noRelativeImports, { valid: [ { - options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], + options: [{ baseUrl: "./src", allowLocalImports: "local" }], code: 'import {foo} from "bla/test"', filename: "/src/nested/deep/test.js", }, { - options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], + options: [{ baseUrl: "./src", allowLocalImports: "local" }], + code: 'import {foo} from "./bla/test"', + filename: "/src/nested/deep/test.js", + }, + { + options: [{ baseUrl: "./src", allowLocalImports: "local" }], code: 'import {foo} from "../../../bla/test"', filename: "/src/nested/deep/test.js", }, { - options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], - code: 'import {foo} from "../bla/test"', + options: [ + { baseUrl: "./src", allowLocalImports: "inside-base-path" }, + ], + code: 'import {foo} from "/bla/test"', filename: "/src/nested/deep/test.js", }, { - options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], + options: [ + { baseUrl: "./src", allowLocalImports: "inside-base-path" }, + ], + code: 'import {foo} from "./bla/test"', + filename: "/src/nested/deep/test.js", + }, + { + options: [ + { baseUrl: "./src", allowLocalImports: "inside-base-path" }, + ], + code: 'import {foo} from "../../../bla/test"', + filename: "/src/nested/deep/test.js", + }, + { + options: [{ baseUrl: "./src" }], code: 'import {foo} from "../../../bla/test"', filename: "/test/nested/deep/test.js", }, @@ -47,37 +68,85 @@ ruleTester.run("my-rule", noRelativeImports, { ], invalid: [ { - options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], - code: 'import {foo} from "../../bla/test"', + options: [{ baseUrl: "./src", allowLocalImports: "local" }], + code: 'import {foo} from "../test2"', filename: "/src/nested/deep/test.js", errors: [ { messageId: "no-relative-import", }, ], - output: 'import {foo} from "bla/test"', + output: 'import {foo} from "nested/test2"', + }, + { + options: [{ baseUrl: "./src", allowLocalImports: "local" }], + code: 'import {foo} from "../../bla/test2"', + filename: "/src/nested/deep/test.js", + errors: [ + { + messageId: "no-relative-import", + }, + ], + output: 'import {foo} from "bla/test2"', + }, + { + options: [{ baseUrl: "./src", allowLocalImports: "local" }], + code: 'import {foo} from "../../../src/nested/test2"', + filename: "/test/nested/deep/test.js", + errors: [ + { + messageId: "no-relative-import", + }, + ], + output: 'import {foo} from "nested/test2"', + }, + { + options: [ + { baseUrl: "./src", allowLocalImports: "inside-base-path" }, + ], + code: 'import {foo} from "../../bla/test2"', + filename: "/src/nested/deep/test.js", + errors: [ + { + messageId: "no-relative-import", + }, + ], + output: 'import {foo} from "bla/test2"', + }, + { + options: [ + { baseUrl: "./src", allowLocalImports: "inside-base-path" }, + ], + code: 'import {foo} from "../../../src/bla/test2"', + filename: "/test/nested/deep/test.js", + errors: [ + { + messageId: "no-relative-import", + }, + ], + output: 'import {foo} from "bla/test2"', }, { options: [{ baseUrl: "./src" }], - code: 'import {foo} from "../bla/test"', + code: 'import {foo} from "./bla/test"', filename: "/src/nested/deep/test.js", errors: [ { messageId: "no-relative-import", }, ], - output: 'import {foo} from "nested/bla/test"', + output: 'import {foo} from "nested/deep/bla/test"', }, { - options: [{ baseUrl: "./src", allowLocalRelativeImports: true }], - code: 'import {foo} from "../../src/bla/test"', - filename: "/somewhere/else/test.js", + options: [{ baseUrl: "./src" }], + code: 'import {foo} from "../bla/test"', + filename: "/src/nested/deep/test.js", errors: [ { messageId: "no-relative-import", }, ], - output: 'import {foo} from "bla/test"', + output: 'import {foo} from "nested/bla/test"', }, { options: [{ baseUrl: "./src" }], From fd4d0c17be93ef2bd1dcd131a272131a2d26e003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20G=C3=BCdelh=C3=B6fer?= Date: Tue, 23 Nov 2021 18:17:52 +0100 Subject: [PATCH 4/7] :sparkles: Update readme --- README.md | 33 +++++++++++++++++++++++++++------ lib/index.ts | 2 +- package.json | 6 +++--- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8a1ddc2..32bb7e8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# eslint-plugin-no-relative-base-url-imports +# @opencreek/eslint-plugin Disalows relative path across the baseUrl of your tsconfig @@ -13,16 +13,20 @@ npm i eslint --save-dev Next, install `eslint-plugin-no-relative-base-url-imports`: ```sh -npm install eslint-plugin-no-relative-base-url-imports --save-dev +npm install @opencreek/eslint-plugin --save-dev +``` + +```sh +yarn add --dev @opencreek/eslint-plugin ``` ## Usage -Add `no-relative-base-url-imports` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: +Add `@opencreek` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: ```json { - "plugins": ["no-relative-base-url-imports"] + "plugins": ["@opencreek"] } ``` @@ -31,11 +35,28 @@ Then configure the rules you want to use under the rules section. ```json { "rules": { - "no-relative-base-url-imports/rule-name": 2 + "@opencreek/no-relative-imports": [ + "error", + { + "baseUrl": "./src" + } + ] } } ``` ## Supported Rules -- Fill in provided rules here +### `@opencreek/no-relative-imports` Disable relative imports. + +Config options + +```ts +{ + "baseUrl": "./src", // The base url that you have set in the tsconfig + "allowLocalImports": "local" // possible values: "local" | "in-base-path". + // "local": Allows local imports (eg.: "./test") + // "in-base-path": Allows everything that does not go back to the base url level (eg: "../../test" in "src/a/b/c/test.ts") +} + +``` diff --git a/lib/index.ts b/lib/index.ts index 28b20aa..5faa2cb 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -20,7 +20,7 @@ export const rules = { export const configs = { recommended: { rules: { - "@opencreek/opencreek/no-relative-imports": "error", + "@opencreek/no-relative-imports": "error", }, }, } diff --git a/package.json b/package.json index 9a93b45..a0fde8a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "@opencreek/eslint-plugin-opencreek", + "name": "@opencreek/eslint-plugin", "version": "0.2.0", - "description": "Disalows relative path across the baseUrl of your tsconfig", + "description": "Disallows relative path across the baseUrl of your tsconfig", "type": "module", "keywords": [ "eslint", @@ -13,7 +13,7 @@ "build/**" ], "author": "Opencreek Technology", - "repository": "https://github.com/opencreek/provider-stack", + "repository": "https://github.com/opencreek/eslint-plugin", "license": "MIT", "publishConfig": { "registry": "https://registry.npmjs.org/", From acf16d746c234920fcaee4e57224f05bf272c7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20G=C3=BCdelh=C3=B6fer?= Date: Wed, 24 Nov 2021 09:45:15 +0100 Subject: [PATCH 5/7] :rotating_light: --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5ab3206..b611db0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "@opencreek/eslint-plugin-opencreek", + "name": "@opencreek/eslint-plugin", "version": "0.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "@opencreek/eslint-plugin-opencreek", - "version": "0.1.0", + "name": "@opencreek/eslint-plugin", + "version": "0.2.0", "license": "MIT", "dependencies": { "@typescript-eslint/experimental-utils": "^5.4.0" From 04ac715441730f9552c18ab5b7503fd3b7e717c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20G=C3=BCdelh=C3=B6fer?= Date: Wed, 24 Nov 2021 09:47:27 +0100 Subject: [PATCH 6/7] :art: Rename variables to better capture what they mean --- lib/rules/no-relative-imports.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/rules/no-relative-imports.ts b/lib/rules/no-relative-imports.ts index d9002a5..e28f12b 100644 --- a/lib/rules/no-relative-imports.ts +++ b/lib/rules/no-relative-imports.ts @@ -63,8 +63,8 @@ export default creator({ options.baseUrl ?? "." ) - const relativeFileName = fileName.replace(basePath, "") - const levels = relativeFileName.split("/").length - 2 + const fileNameInsideBasePath = fileName.replace(basePath, "") + const levels = fileNameInsideBasePath.split("/").length - 2 const levelImport = "../".repeat(levels) const filePath = path.dirname(fileName) @@ -74,7 +74,7 @@ export default creator({ node.source.value ) const isInBasePath = filePath.startsWith(basePath) - const absoluteImportPathWithoutBase = + const absoluteImportPathInsideBasePath = absoluteImportPath.replace(basePath + "/", "") // we import something outside of the basePath @@ -99,7 +99,7 @@ export default creator({ fix: (fixer) => { return fixer.replaceText( node.source, - `"${absoluteImportPathWithoutBase}"` + `"${absoluteImportPathInsideBasePath}"` ) }, }) @@ -122,7 +122,7 @@ export default creator({ fix: (fixer) => { return fixer.replaceText( node.source, - `"${absoluteImportPathWithoutBase}"` + `"${absoluteImportPathInsideBasePath}"` ) }, }) From 44eb84d1337e36fab4cee82d1feadb737091827e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20G=C3=BCdelh=C3=B6fer?= Date: Wed, 24 Nov 2021 10:27:26 +0100 Subject: [PATCH 7/7] :truck: Rename plugin --- README.md | 16 ++++++++-------- lib/index.ts | 2 +- lib/rules/no-relative-imports.ts | 1 + package.json | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 32bb7e8..d221183 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# @opencreek/eslint-plugin +# @opencreek/eslint-plugin-ts Disalows relative path across the baseUrl of your tsconfig @@ -10,23 +10,23 @@ You'll first need to install [ESLint](https://eslint.org/): npm i eslint --save-dev ``` -Next, install `eslint-plugin-no-relative-base-url-imports`: +Next, install `@opencreek/eslint-plugin-ts`: ```sh -npm install @opencreek/eslint-plugin --save-dev +npm install @opencreek/eslint-plugin-ts --save-dev ``` ```sh -yarn add --dev @opencreek/eslint-plugin +yarn add --dev @opencreek/eslint-plugin-ts ``` ## Usage -Add `@opencreek` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: +Add `@opencreek/ts` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: ```json { - "plugins": ["@opencreek"] + "plugins": ["@opencreek/ts"] } ``` @@ -35,7 +35,7 @@ Then configure the rules you want to use under the rules section. ```json { "rules": { - "@opencreek/no-relative-imports": [ + "@opencreek/ts/no-relative-imports": [ "error", { "baseUrl": "./src" @@ -47,7 +47,7 @@ Then configure the rules you want to use under the rules section. ## Supported Rules -### `@opencreek/no-relative-imports` Disable relative imports. +### `@opencreek/ts/no-relative-imports` Disable relative imports. Config options diff --git a/lib/index.ts b/lib/index.ts index 5faa2cb..646b7fb 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -20,7 +20,7 @@ export const rules = { export const configs = { recommended: { rules: { - "@opencreek/no-relative-imports": "error", + "@opencreek/ts/no-relative-imports": "error", }, }, } diff --git a/lib/rules/no-relative-imports.ts b/lib/rules/no-relative-imports.ts index e28f12b..ad84a4d 100644 --- a/lib/rules/no-relative-imports.ts +++ b/lib/rules/no-relative-imports.ts @@ -7,6 +7,7 @@ export type Options = { baseUrl?: string allowLocalImports?: "inside-base-path" | "local" }[] + export type MessageIds = "no-relative-import" export default creator({ name: "no-relative-imports", diff --git a/package.json b/package.json index a0fde8a..fa2a37d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@opencreek/eslint-plugin", + "name": "@opencreek/eslint-plugin-ts", "version": "0.2.0", "description": "Disallows relative path across the baseUrl of your tsconfig", "type": "module", @@ -13,7 +13,7 @@ "build/**" ], "author": "Opencreek Technology", - "repository": "https://github.com/opencreek/eslint-plugin", + "repository": "https://github.com/opencreek/eslint-plugin-ts", "license": "MIT", "publishConfig": { "registry": "https://registry.npmjs.org/",