UNPKG

@vue-storefront/eslint-config

Version:

> Common ESLint configuration used in Alokai projects. These configurations are compatible with ESLint 9.

82 lines (77 loc) 2.17 kB
import { RuleTester } from "eslint"; import test from "node:test"; import plugin, { ERROR_MESSAGE } from "./index.js"; test("no-relative-import-paths", () => { const ruleTester = new RuleTester(); ruleTester.run("no-relative-import-paths", plugin.rules["no-relative-import-paths"], { invalid: [ { code: "import { hello } from './world'", errors: [{ message: ERROR_MESSAGE }], options: [{ allowSameFolder: false, prefix: "@" }], output: "import { hello } from '@/world'", }, { code: "import { hello } from '../world'", errors: [{ message: ERROR_MESSAGE }], }, { code: "import * as hello from '../world'", errors: [{ message: ERROR_MESSAGE }], }, { code: "export { hello } from './world'", errors: [{ message: ERROR_MESSAGE }], options: [{ allowSameFolder: false, prefix: "@" }], output: "export { hello } from '@/world'", }, { code: "export { hello } from '../world'", errors: [{ message: ERROR_MESSAGE }], }, { code: "export * from '../world'", errors: [{ message: ERROR_MESSAGE }], }, { code: "import { hello } from '../../world'", errors: [{ message: ERROR_MESSAGE }], options: [{ allowedDepth: 1 }], }, ], valid: [ { code: "import { hello } from '@/world'", options: [], }, { code: "import * as hello from '@/world'", options: [], }, { code: "import { hello } from './world'", options: [{ allowSameFolder: true }], }, { code: "export { hello } from '@/world'", options: [], }, { code: "export * from '@/world'", options: [], }, { code: "export { hello } from './world'", options: [{ allowSameFolder: true }], }, { code: "import { hello } from '../world'", options: [{ allowedDepth: 1 }], }, { code: "import { hello } from '../../world'", options: [{ allowedDepth: 2 }], }, ], }); });