From ac4fb8267e8d249c61a93d641c82a4a52107c823 Mon Sep 17 00:00:00 2001 From: SimeonC <1085899+SimeonC@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:24:41 +0900 Subject: [PATCH] docs: add docs for eslint-plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a technically “breaking change” in here, but I know no-one is using the undocumented preferredAlias options yet. --- .gitignore | 2 +- nx.json | 5 + package-lock.json | 164 ++++++++++++++++++ package.json | 3 +- .../eslint-plugin/.eslint-doc-generatorrc.js | 11 ++ packages/eslint-plugin/.eslintrc.json | 24 +-- packages/eslint-plugin/README.md | 31 +++- .../__tests__/shortestImport.test.ts | 6 +- .../docs/rules/consistent-react-import.md | 5 + .../docs/rules/forbidden-imports.md | 5 + .../docs/rules/prefer-shortest-import.md | 17 ++ packages/eslint-plugin/package.json | 2 + packages/eslint-plugin/project.json | 24 +++ .../src/consistentReactImport.ts | 1 + .../eslint-plugin/src/forbiddenImports.ts | 1 + packages/eslint-plugin/src/shortestImport.ts | 41 +++-- 16 files changed, 306 insertions(+), 36 deletions(-) create mode 100644 packages/eslint-plugin/.eslint-doc-generatorrc.js create mode 100644 packages/eslint-plugin/docs/rules/consistent-react-import.md create mode 100644 packages/eslint-plugin/docs/rules/forbidden-imports.md create mode 100644 packages/eslint-plugin/docs/rules/prefer-shortest-import.md diff --git a/.gitignore b/.gitignore index edf7ee25..3f605cab 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ node_modules build cache public/static -docs +./docs lib dist config/local.* diff --git a/nx.json b/nx.json index a3577435..8f70ad4a 100644 --- a/nx.json +++ b/nx.json @@ -14,6 +14,11 @@ "inputs": ["default", "^default", "baseTypescript"], "outputs": ["{projectRoot}/dist"] }, + "docs": { + "dependsOn": ["build"], + "inputs": ["default", "^default", "baseTypescript"], + "outputs": ["{projectRoot}/docs"] + }, "test": { "dependsOn": ["^test"], "inputs": ["default", "^default", "testConfig"] diff --git a/package-lock.json b/package-lock.json index 776e0e39..59e993f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,6 +51,7 @@ "auditjs": "4.0.41", "auto": "11.0.4", "eslint": "^8", + "eslint-plugin-eslint-plugin": "5.1.1", "file-loader": "^6.2.0", "fs-extra": "^11.1.1", "husky": "8.0.3", @@ -13241,6 +13242,12 @@ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "dev": true }, + "node_modules/boolean": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", + "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==", + "dev": true + }, "node_modules/bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", @@ -17640,6 +17647,119 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-doc-generator": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/eslint-doc-generator/-/eslint-doc-generator-1.5.3.tgz", + "integrity": "sha512-QVHi3ljaKXHr86L640rYgh0tJY/CTYncy/NbsFpzHu7ENwb0Dc/2xTESfbYeOl6/ILXqJQMMjNfQ4euEi7Rcjw==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "^5.38.1", + "ajv": "^8.11.2", + "boolean": "^3.2.0", + "commander": "^10.0.0", + "cosmiconfig": "^8.0.0", + "deepmerge": "^4.2.2", + "dot-prop": "^7.2.0", + "jest-diff": "^29.2.1", + "json-schema-traverse": "^1.0.0", + "markdown-table": "^3.0.3", + "no-case": "^3.0.4", + "type-fest": "^3.0.0" + }, + "bin": { + "eslint-doc-generator": "dist/bin/eslint-doc-generator.js" + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "eslint": ">= 7" + } + }, + "node_modules/eslint-doc-generator/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/eslint-doc-generator/node_modules/cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "dev": true, + "dependencies": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/eslint-doc-generator/node_modules/dot-prop": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-7.2.0.tgz", + "integrity": "sha512-Ol/IPXUARn9CSbkrdV4VJo7uCy1I3VuSiWCaFSg+8BdUOzF9n3jefIpcgAydvUZbTdEBZs2vEiTiS9m61ssiDA==", + "dev": true, + "dependencies": { + "type-fest": "^2.11.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-doc-generator/node_modules/dot-prop/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-doc-generator/node_modules/markdown-table": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.3.tgz", + "integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/eslint-doc-generator/node_modules/type-fest": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", + "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/eslint-formatter-pretty": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-5.0.0.tgz", @@ -17817,6 +17937,22 @@ "node": ">=0.8.0" } }, + "node_modules/eslint-plugin-eslint-plugin": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-5.1.1.tgz", + "integrity": "sha512-4MGDsG505Ot2TSDSYxFL0cpDo4Y+t6hKB8cfZw9Jx484VjXWDfiYC/A6cccWFtWoOOC0j+wGgQIIb11cdIAMBg==", + "dev": true, + "dependencies": { + "eslint-utils": "^3.0.0", + "estraverse": "^5.3.0" + }, + "engines": { + "node": "^14.17.0 || ^16.0.0 || >= 18.0.0" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-plugin-import": { "version": "2.29.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz", @@ -18098,6 +18234,33 @@ "node": ">=4.0" } }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/eslint-visitor-keys": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", @@ -37699,6 +37862,7 @@ "@typescript-eslint/types": "^6.2.0", "@typescript-eslint/typescript-estree": "^6.2.0", "@typescript-eslint/utils": "^6.2.0", + "eslint-doc-generator": "1.5.3", "fs-extra": "11.1.1", "type-fest": "4.4.0", "typescript": "5.1.6", diff --git a/package.json b/package.json index 5e116689..3c40d5bd 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "scripts": { "audit": "tablecheck-frontend-audit", "audit:ci": "npx tablecheck-frontend-audit --ci", - "lint": "nx affected --target=quality && prettier -c .", + "lint": "nx affected --target=quality && nx affected --target=quality:docs && prettier -c .", "format": "nx affected --target=quality:format && prettier -w --loglevel warn .", "test": "nx affected --target=test", "test:watch": "nx run-many --target=test:watch", @@ -59,6 +59,7 @@ "auditjs": "4.0.41", "auto": "11.0.4", "eslint": "^8", + "eslint-plugin-eslint-plugin": "5.1.1", "file-loader": "^6.2.0", "fs-extra": "^11.1.1", "husky": "8.0.3", diff --git a/packages/eslint-plugin/.eslint-doc-generatorrc.js b/packages/eslint-plugin/.eslint-doc-generatorrc.js new file mode 100644 index 00000000..03c429aa --- /dev/null +++ b/packages/eslint-plugin/.eslint-doc-generatorrc.js @@ -0,0 +1,11 @@ +const prettier = require('prettier'); + +/** @type {import('eslint-doc-generator').GenerateOptions} */ +const config = { + postprocess: async (content, path) => { + const prettierRC = await prettier.resolveConfig(path); + return prettier.format(content, { ...prettierRC, parser: 'markdown' }); + }, +}; + +module.exports = config; diff --git a/packages/eslint-plugin/.eslintrc.json b/packages/eslint-plugin/.eslintrc.json index d3e61a2e..1c78fe3f 100644 --- a/packages/eslint-plugin/.eslintrc.json +++ b/packages/eslint-plugin/.eslintrc.json @@ -1,18 +1,12 @@ { - "extends": ["../../.eslintrc.js"], "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] + "parserOptions": { + "sourceType": "script" + }, + "extends": ["../../.eslintrc.js", "plugin:eslint-plugin/recommended"], + "rules": { + "eslint-plugin/require-meta-docs-url": "error", + "eslint-plugin/require-meta-docs-description": "error", + "eslint-plugin/require-meta-schema": "error" + } } diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index bd723434..71b0d5be 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -1,3 +1,30 @@ -This eslint-plugin is used internally in the eslint-config. +# @tablecheck/eslint-plugins -Custom rules must be done in a plugin and cannot be done in an eslint-config by default, plugins must be separate packages. +This repository contains custom eslint plugins that can be used to enforce coding standards and best practices in your JavaScript projects. + +These rules were written for code consistency in our Frontend Team at [TableCheck](https://www.tablecheck.com/en/join/). + +Learn more about [TableCheck](https://www.tablecheck.com/en/join/) and check out our [Careers page](https://careers.tablecheck.com). + +## Installation + +To install the plugins, run the following command: + +```sh +npm install --save-dev @tablecheck/eslint-plugin +``` + +## Rules + + + +🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\ +💭 Requires type information. + +| Name                    | Description | 🔧 | 💭 | +| :--------------------------------------------------------------- | :------------------------------------------------------------------------------------------ | :-- | :-- | +| [consistent-react-import](docs/rules/consistent-react-import.md) | Ensure that react is always imported and used consistently | 🔧 | | +| [forbidden-imports](docs/rules/forbidden-imports.md) | Ensure that certain packages are using specific imports instead of using the default import | 🔧 | | +| [prefer-shortest-import](docs/rules/prefer-shortest-import.md) | Enforce the consistent use of preferred import paths | 🔧 | 💭 | + + diff --git a/packages/eslint-plugin/__tests__/shortestImport.test.ts b/packages/eslint-plugin/__tests__/shortestImport.test.ts index 99e58d7d..c8908845 100644 --- a/packages/eslint-plugin/__tests__/shortestImport.test.ts +++ b/packages/eslint-plugin/__tests__/shortestImport.test.ts @@ -179,12 +179,12 @@ typescriptSetups.forEach((config) => { { path: '~/feature1/index', filename: './test_src/feature1/slice1/index.ts', - options: [['~/feature1', 'feature1']], + options: [{ preferredAlias: ['~/feature1', 'feature1'] }], }, { path: '~/feature1/slice1', filename: './test_src/feature1/index.ts', - options: [['~/feature1', 'feature1']], + options: [{ preferredAlias: ['~/feature1', 'feature1'] }], }, { path: '@node/module', @@ -272,7 +272,7 @@ typescriptSetups.forEach((config) => { fixedPath: '~/feature1/index', filename: './test_src/feature1/slice1/index.ts', errors: [{ messageId }], - options: [['~/feature1', 'feature1']], + options: [{ preferredAlias: ['~/feature1', 'feature1'] }], }, ] .filter((c) => !c.skipConfigs || !c.skipConfigs.includes(config.name)) diff --git a/packages/eslint-plugin/docs/rules/consistent-react-import.md b/packages/eslint-plugin/docs/rules/consistent-react-import.md new file mode 100644 index 00000000..10ba5c3c --- /dev/null +++ b/packages/eslint-plugin/docs/rules/consistent-react-import.md @@ -0,0 +1,5 @@ +# Ensure that react is always imported and used consistently (`@tablecheck/consistent-react-import`) + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + diff --git a/packages/eslint-plugin/docs/rules/forbidden-imports.md b/packages/eslint-plugin/docs/rules/forbidden-imports.md new file mode 100644 index 00000000..dc7bc891 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/forbidden-imports.md @@ -0,0 +1,5 @@ +# Ensure that certain packages are using specific imports instead of using the default import (`@tablecheck/forbidden-imports`) + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + + diff --git a/packages/eslint-plugin/docs/rules/prefer-shortest-import.md b/packages/eslint-plugin/docs/rules/prefer-shortest-import.md new file mode 100644 index 00000000..822bb6d8 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/prefer-shortest-import.md @@ -0,0 +1,17 @@ +# Enforce the consistent use of preferred import paths (`@tablecheck/prefer-shortest-import`) + +🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). + +💭 This rule requires type information. + + + +## Options + + + +| Name | Description | Type | +| :--------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | +| `preferredAlias` | A list of alias paths to prefer over relative paths, for example, providing `["~/utils"]` will prefer `~/utils/useSomething` over `../useSomething` or `./useSomething` | String[] | + + diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 720bc8af..25f29454 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -33,7 +33,9 @@ "@typescript-eslint/types": "^6.2.0", "@typescript-eslint/typescript-estree": "^6.2.0", "@typescript-eslint/utils": "^6.2.0", + "eslint-doc-generator": "1.5.3", "fs-extra": "11.1.1", + "prettier": "3.0.3", "type-fest": "4.4.0", "typescript": "5.1.6", "vite": "4.4.1", diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json index 2467cd74..78b265a4 100644 --- a/packages/eslint-plugin/project.json +++ b/packages/eslint-plugin/project.json @@ -19,6 +19,14 @@ "fix": true } }, + "quality:docs": { + "inputs": ["{projectRoot}/README.md", "{projectRoot}/docs/**/*"], + "executor": "nx:run-commands", + "options": { + "command": "npx eslint-doc-generator --check", + "cwd": "{projectRoot}" + } + }, "test": { "executor": "@nx/vite:test", "outputs": ["{workspaceRoot}/coverage/packages/eslint-plugin"], @@ -37,6 +45,22 @@ "watch": true, "reportsDirectory": "../../coverage/packages/eslint-plugin" } + }, + "docs": { + "outputs": ["{projectRoot}/README.md"], + "executor": "nx:run-commands", + "options": { + "command": "npx eslint-doc-generator", + "cwd": "{projectRoot}" + } + }, + "docs:add": { + "outputs": ["{projectRoot}/README.md"], + "executor": "nx:run-commands", + "options": { + "command": "npx eslint-doc-generator --init-rule-docs", + "cwd": "{projectRoot}" + } } }, "tags": [] diff --git a/packages/eslint-plugin/src/consistentReactImport.ts b/packages/eslint-plugin/src/consistentReactImport.ts index f2af56aa..a9ad077c 100644 --- a/packages/eslint-plugin/src/consistentReactImport.ts +++ b/packages/eslint-plugin/src/consistentReactImport.ts @@ -11,6 +11,7 @@ export const consistentReactImport: TSESLint.RuleModule = { docs: { description: 'Ensure that react is always imported and used consistently', recommended: 'recommended', + url: 'https://github.com/tablecheck/frontend/tree/main/packages/eslint-plugin/docs/rules/consistent-react-import.md', }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/forbiddenImports.ts b/packages/eslint-plugin/src/forbiddenImports.ts index 5e947441..0670a816 100644 --- a/packages/eslint-plugin/src/forbiddenImports.ts +++ b/packages/eslint-plugin/src/forbiddenImports.ts @@ -64,6 +64,7 @@ export const forbiddenImports: TSESLint.RuleModule = { description: 'Ensure that certain packages are using specific imports instead of using the default import', recommended: 'recommended', + url: 'https://github.com/tablecheck/frontend/tree/main/packages/eslint-plugin/docs/rules/forbidden-imports.md', }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/shortestImport.ts b/packages/eslint-plugin/src/shortestImport.ts index fa39d8aa..68fd0c38 100644 --- a/packages/eslint-plugin/src/shortestImport.ts +++ b/packages/eslint-plugin/src/shortestImport.ts @@ -93,10 +93,7 @@ class RuleChecker { private getImportMeta( context: Readonly< - TSESLint.RuleContext< - 'shortestImport' | 'types-failed', - never[] | [string[]] - > + TSESLint.RuleContext<'shortestImport' | 'types-failed', OptionsShape> >, node: ImportExpression | ImportDeclaration, ): @@ -123,10 +120,7 @@ class RuleChecker { public execute( context: Readonly< - TSESLint.RuleContext< - 'shortestImport' | 'types-failed', - never[] | [string[]] - > + TSESLint.RuleContext<'shortestImport' | 'types-failed', OptionsShape> >, node: ImportExpression | ImportDeclaration, ) { @@ -156,7 +150,7 @@ class RuleChecker { relativePath, aliasPaths, baseUrlPaths, - preferredAliasPaths: context.options[0] || [], + preferredAliasPaths: context.options[0]?.preferredAlias ?? [], }); if (preferredPath === importPath) return; @@ -408,21 +402,40 @@ function getRuleChecker(compilerOptions: CompilerOptions): RuleChecker { return metaCache.get(cacheKey)!; } +type OptionsShape = [ + | { + preferredAlias: string[]; + } + | undefined, +]; + export const shortestImport: TSESLint.RuleModule< typeof messageId | 'types-failed', - [string[]] | never[] + OptionsShape > = { meta: { type: 'problem', docs: { - description: - 'Enforce the consistent use of preferred import paths. A list of alias paths to prefer over relative paths can also be provided', + description: 'Enforce the consistent use of preferred import paths', recommended: 'stylistic', + requiresTypeChecking: true, + url: 'https://github.com/tablecheck/frontend/tree/main/packages/eslint-plugin/docs/rules/shortest-import.md', }, fixable: 'code', schema: [ { - type: 'array', + type: 'object', + properties: { + preferredAlias: { + type: 'array', + description: + 'A list of alias paths to prefer over relative paths, for example, providing `["~/utils"]` will prefer `~/utils/useSomething` over `../useSomething` or `./useSomething`', + title: 'Preferred alias paths', + items: { + type: 'string', + }, + }, + }, }, ], messages: { @@ -430,7 +443,7 @@ export const shortestImport: TSESLint.RuleModule< 'types-failed': 'Typescript needs to be enabled for this rule', }, }, - defaultOptions: [], + defaultOptions: [undefined], create(context) { const compilerOptions = context .getSourceCode()