@@ -6,23 +6,22 @@ import { csonConfig } from "./cson.cjs"
66import { yamlConfig } from "./yaml.cjs"
77import { htmlConfig } from "./html.cjs"
88import { pluginImportSettings } from "./plugin-import-rules.cjs"
9- import semverLt from "semver/functions/lt "
9+ import semverMajor from "semver/functions/major "
1010import { getEslintVersion } from "./eslint-version.cjs"
1111
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 ]
2220 }
21+ } catch ( _err ) {
22+ // optional plugin
2323 }
24- } catch ( _err ) {
25- // optional plugin
24+ return [ ]
2625}
2726
2827const config = {
@@ -39,7 +38,7 @@ const config = {
3938 measure : "readonly" ,
4039 } ,
4140 ...jsConfig ,
42- overrides,
41+ overrides : [ tsConfig , jsonConfig , yamlConfig , htmlConfig , ... maybeAddCoffeeScript ( ) ] ,
4342 settings : {
4443 ...pluginImportSettings ,
4544 } ,
0 commit comments