@@ -15,13 +15,6 @@ const path = require("node:path");
1515const { version } = require ( "../../package.json" ) ;
1616const { Linter } = require ( "../linter" ) ;
1717const { defaultConfig } = require ( "../config/default-config" ) ;
18- const {
19- Legacy : {
20- ConfigOps : { getRuleSeverity } ,
21- ModuleResolver,
22- naming,
23- } ,
24- } = require ( "@eslint/eslintrc" ) ;
2518
2619const {
2720 findFiles,
@@ -41,6 +34,13 @@ const LintResultCache = require("../cli-engine/lint-result-cache");
4134const { Retrier } = require ( "@humanwhocodes/retry" ) ;
4235const { ConfigLoader, LegacyConfigLoader } = require ( "../config/config-loader" ) ;
4336const { WarningService } = require ( "../services/warning-service" ) ;
37+ const { Config } = require ( "../config/config.js" ) ;
38+ const {
39+ getShorthandName,
40+ getNamespaceFromTerm,
41+ normalizePackageName,
42+ } = require ( "../shared/naming.js" ) ;
43+ const { resolve } = require ( "../shared/relative-module-resolver.js" ) ;
4444
4545/*
4646 * This is necessary to allow overwriting writeFile for testing purposes.
@@ -160,7 +160,7 @@ function getOrFindUsedDeprecatedRules(eslint, maybeFilePath) {
160160
161161 if ( config . rules ) {
162162 for ( const [ ruleId , ruleConf ] of Object . entries ( config . rules ) ) {
163- if ( getRuleSeverity ( ruleConf ) === 0 ) {
163+ if ( Config . getRuleNumericSeverity ( ruleConf ) === 0 ) {
164164 continue ;
165165 }
166166 const rule = config . getRuleDefinition ( ruleId ) ;
@@ -174,7 +174,7 @@ function getOrFindUsedDeprecatedRules(eslint, maybeFilePath) {
174174 replacedBy : usesNewFormat
175175 ? ( meta . deprecated . replacedBy ?. map (
176176 replacement =>
177- `${ replacement . plugin ?. name !== void 0 ? `${ naming . getShorthandName ( replacement . plugin . name , "eslint-plugin" ) } /` : "" } ${ replacement . rule ?. name ?? "" } ` ,
177+ `${ replacement . plugin ?. name !== void 0 ? `${ getShorthandName ( replacement . plugin . name , "eslint-plugin" ) } /` : "" } ${ replacement . rule ?. name ?? "" } ` ,
178178 ) ?? [ ] )
179179 : meta . replacedBy || [ ] ,
180180 info : usesNewFormat ? meta . deprecated : void 0 ,
@@ -489,8 +489,7 @@ class ESLint {
489489 for ( const [ pluginName , plugin ] of Object . entries (
490490 options . plugins ,
491491 ) ) {
492- plugins [ naming . getShorthandName ( pluginName , "eslint-plugin" ) ] =
493- plugin ;
492+ plugins [ getShorthandName ( pluginName , "eslint-plugin" ) ] = plugin ;
494493 }
495494
496495 defaultConfigs . push ( {
@@ -998,7 +997,7 @@ class ESLint {
998997
999998 // replace \ with / for Windows compatibility
1000999 const normalizedFormatName = name . replace ( / \\ / gu, "/" ) ;
1001- const namespace = naming . getNamespaceFromTerm ( normalizedFormatName ) ;
1000+ const namespace = getNamespaceFromTerm ( normalizedFormatName ) ;
10021001
10031002 // grab our options
10041003 const { cwd } = privateMembers . get ( this ) . options ;
@@ -1010,16 +1009,13 @@ class ESLint {
10101009 formatterPath = path . resolve ( cwd , normalizedFormatName ) ;
10111010 } else {
10121011 try {
1013- const npmFormat = naming . normalizePackageName (
1012+ const npmFormat = normalizePackageName (
10141013 normalizedFormatName ,
10151014 "eslint-formatter" ,
10161015 ) ;
10171016
10181017 // TODO: This is pretty dirty...would be nice to clean up at some point.
1019- formatterPath = ModuleResolver . resolve (
1020- npmFormat ,
1021- getPlaceholderPath ( cwd ) ,
1022- ) ;
1018+ formatterPath = resolve ( npmFormat , getPlaceholderPath ( cwd ) ) ;
10231019 } catch {
10241020 formatterPath = path . resolve (
10251021 __dirname ,
0 commit comments