Skip to content

Commit

Permalink
feat: generate react config
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Feb 3, 2021
1 parent e7908ca commit 473a319
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 82 deletions.
100 changes: 19 additions & 81 deletions react.js
Original file line number Diff line number Diff line change
@@ -1,87 +1,25 @@
const base = require("./index.js")

let overrides = base.overrides
overrides[0] = {
"plugins": ["react", "@typescript-eslint", "only-warn"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint",
"prettier/react"
],
rules: overrides[0].rules
}

module.exports = {
// JS Files
"root": true,
"env": {
"atomtest": true,
"es6": true,
"node": true,
"browser": true,
"jasmine": true
},
"globals": {
"atom": "readonly",
"measure": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
...base,
"plugins": ["react", "only-warn"],
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier", "prettier/react"],
"ignorePatterns": ["node_modules/"],
"overrides": [
{
// Bundled node version with atom has an old ESLint
// TypeScript files
"files": ["**/*.ts", "**/*.tsx"],
"parser": "@typescript-eslint/parser",
"plugins": ["react", "@typescript-eslint", "only-warn"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint",
"prettier/react"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/member-delimiter-style": "off"
}
},
{
// JSON files
"files": ["*.json"],
"plugins": ["json"],
"extends": ["prettier", "plugin:json/recommended"],
"rules": {
"json/*": [
"error",
{
"allowComments": true
}
]
}
},
{
// CoffeeScript files
"files": ["**/*.coffee"],
"parser": "eslint-plugin-coffee",
"plugins": ["coffee", "only-warn"],
"extends": ["plugin:coffee/eslint-recommended"]
},
{
// YAML files
"files": ["*.yaml", "*.yml"],
"plugins": ["yaml"],
"extends": ["plugin:yaml/recommended"]
},
// CSON files (use coffee)
{
"files": ["**/*.cson"],
"parser": "eslint-plugin-coffee",
"plugins": ["coffee", "only-warn"],
"extends": ["plugin:coffee/eslint-recommended"]
}
],
"overrides": overrides,
"settings": {
"react": {
"version": "detect"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.strict.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const fileMap = {

filesPaths.forEach(async (filePath) => {
const text = (await readFile(filePath)).toString()
const newText = text.replace(/"only-warn"/g, "")
const newText = text.replace(/"only-warn"/g, "").replace("index.js", "strict.js")
await writeFile(join(root, fileMap[basename(filePath)]), newText)
})
})()

0 comments on commit 473a319

Please sign in to comment.