From 1f8fb1f2041278afda89f6a3786ceca080083c39 Mon Sep 17 00:00:00 2001 From: aminya Date: Sun, 19 Jul 2020 01:42:24 -0500 Subject: [PATCH] fix: add separate react and strict-react presets --- index.js | 13 +++----- react.js | 82 +++++++++++++++++++++++++++++++++++++++++++++++++ strict-react.js | 82 +++++++++++++++++++++++++++++++++++++++++++++++++ strict.js | 13 +++----- 4 files changed, 172 insertions(+), 18 deletions(-) create mode 100644 react.js create mode 100644 strict-react.js diff --git a/index.js b/index.js index 3d3e3ae..956b277 100644 --- a/index.js +++ b/index.js @@ -20,8 +20,8 @@ module.exports = { "ecmaVersion": 2018, "sourceType": "module" }, - "plugins": ["prettier", "react", "only-warn"], - "extends": ["prettier", "eslint:recommended", "plugin:react/recommended"], + "plugins": ["prettier", "only-warn"], + "extends": ["prettier", "eslint:recommended"], "ignorePatterns": ["node_modules/"], "overrides": [ { @@ -29,7 +29,7 @@ module.exports = { // TypeScript files "files": ["**/*.ts", "**/*.tsx"], "parser": "@typescript-eslint/parser", - "plugins": ["prettier", "react", "@typescript-eslint", "only-warn"], + "plugins": ["prettier", "@typescript-eslint", "only-warn"], "extends": [ "prettier", "prettier/@typescript-eslint", @@ -73,10 +73,5 @@ module.exports = { "plugins": ["yaml"], "extends": ["plugin:yaml/recommended"] } - ], - "settings": { - "react": { - "version": "detect" - } - } + ] } diff --git a/react.js b/react.js new file mode 100644 index 0000000..3d3e3ae --- /dev/null +++ b/react.js @@ -0,0 +1,82 @@ +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" + }, + "plugins": ["prettier", "react", "only-warn"], + "extends": ["prettier", "eslint:recommended", "plugin:react/recommended"], + "ignorePatterns": ["node_modules/"], + "overrides": [ + { + // Bundled node version with atom has an old ESLint + // TypeScript files + "files": ["**/*.ts", "**/*.tsx"], + "parser": "@typescript-eslint/parser", + "plugins": ["prettier", "react", "@typescript-eslint", "only-warn"], + "extends": [ + "prettier", + "prettier/@typescript-eslint", + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "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"] + } + ], + "settings": { + "react": { + "version": "detect" + } + } +} diff --git a/strict-react.js b/strict-react.js new file mode 100644 index 0000000..adca357 --- /dev/null +++ b/strict-react.js @@ -0,0 +1,82 @@ +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" + }, + "plugins": ["prettier", "react"], + "extends": ["prettier", "eslint:recommended", "plugin:react/recommended"], + "ignorePatterns": ["node_modules/"], + "overrides": [ + { + // Bundled node version with atom has an old ESLint + // TypeScript files + "files": ["**/*.ts", "**/*.tsx"], + "parser": "@typescript-eslint/parser", + "plugins": ["prettier", "react", "@typescript-eslint"], + "extends": [ + "prettier", + "prettier/@typescript-eslint", + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "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"], + "extends": ["plugin:coffee/eslint-recommended"] + }, + { + // YAML files + "files": ["*.yaml", "*.yml"], + "plugins": ["yaml"], + "extends": ["plugin:yaml/recommended"] + } + ], + "settings": { + "react": { + "version": "detect" + } + } +} diff --git a/strict.js b/strict.js index adca357..81f5c56 100644 --- a/strict.js +++ b/strict.js @@ -20,8 +20,8 @@ module.exports = { "ecmaVersion": 2018, "sourceType": "module" }, - "plugins": ["prettier", "react"], - "extends": ["prettier", "eslint:recommended", "plugin:react/recommended"], + "plugins": ["prettier"], + "extends": ["prettier", "eslint:recommended"], "ignorePatterns": ["node_modules/"], "overrides": [ { @@ -29,7 +29,7 @@ module.exports = { // TypeScript files "files": ["**/*.ts", "**/*.tsx"], "parser": "@typescript-eslint/parser", - "plugins": ["prettier", "react", "@typescript-eslint"], + "plugins": ["prettier", "@typescript-eslint"], "extends": [ "prettier", "prettier/@typescript-eslint", @@ -73,10 +73,5 @@ module.exports = { "plugins": ["yaml"], "extends": ["plugin:yaml/recommended"] } - ], - "settings": { - "react": { - "version": "detect" - } - } + ] }