Skip to content

Commit 2915bc4

Browse files
committedFeb 17, 2022
feat: make coffee plugin optional
1 parent e019f0b commit 2915bc4

File tree

4 files changed

+225
-148
lines changed

4 files changed

+225
-148
lines changed
 

‎package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,15 @@
2727
"@babel/plugin-syntax-jsx": "^7.16.7",
2828
"@typescript-eslint/eslint-plugin": "^5.10.1",
2929
"@typescript-eslint/parser": "^5.10.1",
30-
"coffeescript": "^1",
3130
"eslint": "^7",
3231
"eslint-config-prettier": "^8.3.0",
33-
"eslint-plugin-coffee": "^0.1.15",
3432
"eslint-plugin-html": "^6.2.0",
3533
"eslint-plugin-import": "^2.25.4",
3634
"eslint-plugin-json": "^3.1.0",
3735
"eslint-plugin-node": "^11.1.0",
3836
"eslint-plugin-only-warn": "npm:@aminya/eslint-plugin-only-warn@^1.2.2",
3937
"eslint-plugin-optimize-regex": "^1.2.1",
4038
"eslint-plugin-react": "^7.28.0",
41-
"eslint-plugin-react-hooks": "^4.3.0",
4239
"eslint-plugin-yaml": "^0.5.0",
4340
"prettier": "^2",
4441
"read-pkg-up": "^7",
@@ -55,6 +52,11 @@
5552
"peerDependencies": {
5653
"eslint": "^7"
5754
},
55+
"optionalDependencies": {
56+
"coffeescript": "^1",
57+
"eslint-plugin-coffee": "^0.1.15",
58+
"eslint-plugin-react-hooks": "^4.3.0"
59+
},
5860
"keywords": [
5961
"eslint",
6062
"config",

‎pnpm-lock.yaml

+205-142
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml

-2
This file was deleted.

‎src/index.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ const { yamlConfig } = require("./yaml")
77
const { htmlConfig } = require("./html")
88
const { pluginImportSettings } = require("./plugin-import-rules")
99

10+
const overrides = [tsConfig, jsonConfig, yamlConfig, htmlConfig]
11+
12+
// add coffee if installed
13+
if (coffeeConfig !== {}) {
14+
try {
15+
const found = require.resolve("eslint-plugin-coffee")
16+
if (found) {
17+
overrides.push(coffeeConfig, csonConfig)
18+
}
19+
} catch (_err) {
20+
// optional plugin
21+
}
22+
}
23+
1024
module.exports = {
1125
root: true,
1226
env: {
@@ -21,7 +35,7 @@ module.exports = {
2135
measure: "readonly",
2236
},
2337
...jsConfig,
24-
overrides: [tsConfig, coffeeConfig, jsonConfig, csonConfig, yamlConfig, htmlConfig],
38+
overrides,
2539
settings: {
2640
...pluginImportSettings,
2741
},

0 commit comments

Comments
 (0)
Please sign in to comment.