-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix]
no-unused-modules
: don't error out when running with flat con…
…fig and an eslintrc isn't present This change adjusts how we're instantiating the FileEnumerator from eslint's unsupported api, in the case that the user is running with flat config. We have to turn off the `useEslintrc` property on the ConfigArrayFactory that's passed into the FileEnumerator's constructor. Note: This doesn't fix the fact that the FileEnumerator doesn't have knowledge of what the user's config is ignoring, it just prevents the rule from looking for a legacy / rc config and erroring out. FileEnumerator used the rc config to understand which files to ignore.
- Loading branch information
1 parent
78c3a55
commit 7ba8372
Showing
14 changed files
with
282 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import importPlugin from 'eslint-plugin-import'; | ||
import js from '@eslint/js'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
importPlugin.flatConfigs.recommended, | ||
importPlugin.flatConfigs.react, | ||
importPlugin.flatConfigs.typescript, | ||
{ | ||
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'], | ||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
}, | ||
ignores: ['eslint.config.mjs', '**/exports-unused.ts'], | ||
rules: { | ||
'no-unused-vars': 'off', | ||
'import/no-dynamic-require': 'warn', | ||
'import/no-nodejs-modules': 'warn', | ||
'import/no-unused-modules': ['warn', { unusedExports: true }], | ||
'import/no-cycle': 'warn', | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "v9", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"lint": "eslint src --report-unused-disable-directives" | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.17.0", | ||
"@types/node": "^20.14.5", | ||
"@typescript-eslint/parser": "^8.18.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^9.17.0", | ||
"eslint-plugin-import": "file:../..", | ||
"move-file-cli": "^3.0.0", | ||
"typescript": "^5.4.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { foo } from "./es6/depth-one-dynamic"; | ||
|
||
foo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function foo() {} | ||
|
||
export const bar = () => import("../depth-zero").then(({foo}) => foo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export type ScalarType = string | number; | ||
export type ObjType = { | ||
a: ScalarType; | ||
b: ScalarType; | ||
}; | ||
|
||
export const a = 13; | ||
export const b = 18; | ||
|
||
const defaultExport: ObjType = { a, b }; | ||
|
||
export default defaultExport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export type ScalarType = string | number; | ||
export type ObjType = { | ||
a: ScalarType; | ||
b: ScalarType; | ||
}; | ||
|
||
export const a = 13; | ||
export const b = 18; | ||
|
||
const defaultExport: ObjType = { a, b }; | ||
|
||
export default defaultExport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//import c from './exports'; | ||
import { a, b } from './exports'; | ||
import type { ScalarType, ObjType } from './exports'; | ||
|
||
import path from 'path'; | ||
import fs from 'node:fs'; | ||
import console from 'console'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const Components = () => { | ||
return <></>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"lib": ["ESNext"], | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"rootDir": "./", | ||
"moduleResolution": "Bundler", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.