Skip to content

Commit

Permalink
chore: use a runtime script to build strict configs
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Mar 5, 2021
1 parent b5269b8 commit 41c0105
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ package-lock.json
# Build directories
dist

strict.js
strict-react.js
spec/fixtures/atom-community
spec/fixtures/atom-minimap
spec/fixtures/aminya
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
"test.lint": "eslint .",
"test": "node ./spec/test.js",
"clean": "shx rm -rf ./spec/fixtures/atom-community ./spec/fixtures/atom-minimap ./spec/fixtures/steelbrain ./strict.js ./strict-react.js",
"build.strict": "node ./scripts/build.strict.js",
"prepare": "npm run build.strict",
"bump": "ncu -u -x coffeescript"
},
"dependencies": {
Expand Down
22 changes: 0 additions & 22 deletions scripts/build.strict.js

This file was deleted.

16 changes: 16 additions & 0 deletions src/index-strict-react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const nonStrictConfig = require("./index-react")

// remove only-warn from javascript
if (nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn") {
nonStrictConfig.plugins.pop()
}

// remove only-warn from overrides
nonStrictConfig.overrides.forEach(overrides => {
if (overrides.plugins[overrides.plugins.length - 1] === "only-warn") {
overrides.plugins.pop()
}
})


module.exports = nonStrictConfig
18 changes: 18 additions & 0 deletions src/index-strict.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const nonStrictConfig = require("./index")


// remove only-warn from javascript
if (nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn") {
nonStrictConfig.plugins.pop()
}

// remove only-warn from overrides
nonStrictConfig.overrides.forEach(overrides => {
if (overrides.plugins[overrides.plugins.length - 1] === "only-warn") {
overrides.plugins.pop()
}
})

console.log(nonStrictConfig)

module.exports = nonStrictConfig
1 change: 1 addition & 0 deletions strict-react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("./src/index-strict-react.js")
1 change: 1 addition & 0 deletions strict.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("./src/index-strict.js")

0 comments on commit 41c0105

Please sign in to comment.