@@ -6,23 +6,22 @@ import { csonConfig } from "./cson.cjs"
6
6
import { yamlConfig } from "./yaml.cjs"
7
7
import { htmlConfig } from "./html.cjs"
8
8
import { pluginImportSettings } from "./plugin-import-rules.cjs"
9
- import semverLt from "semver/functions/lt "
9
+ import semverMajor from "semver/functions/major "
10
10
import { getEslintVersion } from "./eslint-version.cjs"
11
11
12
- const overrides = [ tsConfig , jsonConfig , yamlConfig , htmlConfig ]
13
-
14
- // add coffee if installed
15
- try {
16
- // check if the eslint version is >= 8
17
- if ( semverLt ( getEslintVersion ( ) , "8.0.0" ) ) {
18
- // if so try adding the coffee plugin
19
- const found = require . resolve ( "eslint-plugin-coffee" )
20
- if ( found ) {
21
- overrides . push ( coffeeConfig , csonConfig )
12
+ function maybeAddCoffeeScript ( ) {
13
+ try {
14
+ const eslintVersion = semverMajor ( getEslintVersion ( ) )
15
+ // check if the eslint version is < 8
16
+ // and if coffee installed
17
+ if ( eslintVersion < 8 && require . resolve ( "eslint-plugin-coffee" ) ) {
18
+ // if so try adding the coffee plugin
19
+ return [ coffeeConfig , csonConfig ]
22
20
}
21
+ } catch ( _err ) {
22
+ // optional plugin
23
23
}
24
- } catch ( _err ) {
25
- // optional plugin
24
+ return [ ]
26
25
}
27
26
28
27
const config = {
@@ -39,7 +38,7 @@ const config = {
39
38
measure : "readonly" ,
40
39
} ,
41
40
...jsConfig ,
42
- overrides,
41
+ overrides : [ tsConfig , jsonConfig , yamlConfig , htmlConfig , ... maybeAddCoffeeScript ( ) ] ,
43
42
settings : {
44
43
...pluginImportSettings ,
45
44
} ,
0 commit comments