From f1f4d7cf96504b40be15bc4717a4f1667adeda47 Mon Sep 17 00:00:00 2001 From: Erwin Govaerts Date: Tue, 23 Feb 2021 21:43:04 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5removal=20of=20flowtype=20&=20lodas?= =?UTF-8?q?h=20+=20=E2=AC=86=EF=B8=8Fupgrade=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 43 ++++++++------------ flowtype.js | 1 - lodash.js | 1 - package.json | 28 ++++++------- packages/base.json | 4 +- packages/core.json | 10 ++--- packages/flowtype.json | 88 ---------------------------------------- packages/lodash.json | 74 --------------------------------- packages/typescript.json | 2 +- typescript.js | 1 + 10 files changed, 39 insertions(+), 213 deletions(-) delete mode 100644 flowtype.js delete mode 100644 lodash.js delete mode 100644 packages/flowtype.json delete mode 100644 packages/lodash.json create mode 100644 typescript.js diff --git a/README.md b/README.md index 7f40863..cfb88b8 100644 --- a/README.md +++ b/README.md @@ -4,56 +4,47 @@ _A fair-minded way to reduce noise in Javascript_ The goal of this package is to have a consistent coding style across multiple files / projects while not being overly strict and have a minimal setup procedure. -The package contains our ESLint rules, including ES6, React, TypeScript, FlowType & Lodash. +The package contains our ESLint rules, including ES6, React & TypeScript. -> Note: We also use [Prettier](https://github.com/prettier/prettier) as a precommit hook, together with their [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier), so we might not meet your standards on indentation etc. If you do need it, you can always override the configuration with extra rules. See [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) for more information. +> Note: We also use [Prettier](https://github.com/prettier/prettier) and integrated [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) within this package, so we might not meet your standards on indentation etc. If needed, you can always override the configuration with extra rules. See [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) for more information. ## Usage ### Installation ``` -yarn add @codit/eslint-config eslint@^6.8.0 --dev +yarn add @codit/eslint-config eslint@^7.2.0 --dev ``` -Install dependencies. ESLint plugins [must also be installed](https://github.com/eslint/rfcs/pull/5). +Install peer dependencies. ``` -yarn add -D eslint-plugin-babel@^5.3.0 eslint-plugin-filenames@^1.3.2 eslint-plugin-import@^2.19.1 eslint-plugin-promise@^4.2.1 eslint-plugin-react@^7.17.0 eslint-config-prettier@^6.9.0 +yarn add --dev @babel/eslint-plugin@^7.13.0 @typescript-eslint/eslint-plugin@^4.15.2 eslint@^7.20.0 eslint-plugin-filenames@^1.3.2 eslint-plugin-import@^2.22.1 eslint-plugin-promise@^4.3.1 eslint-plugin-react@^7.22.0 eslint-plugin-react-hooks@^4.2.0 ``` ### Configuration -The following configuration contains a setup for ES6, React, TypeScript & Prettier +The following configuration contains a setup for ES6, React, TypeScript & Prettier, add it to your `.eslintrc` file ``` - "eslintConfig": { - "extends": [ - "@codit" - ] - } +"extends": ["@codit"] ``` -Or if you want to take more control or don't use TypeScript, you can also extend the packages as follows (make sure to also install the correct dependencies, FlowType & Lodash f.e. are not listed in the step above): +Or if you want to take more control or don't use TypeScript, you can also extend the packages as follows (make sure to also install the correct dependencies): ``` -"eslintConfig": { - "extends": [ - "@codit/core", - "@codit/flowtype", - "@codit/lodash", - "@codit/react" - ] - } + +"extends": [ + "@codit/eslint-config/core", + "@codit/eslint-config/react" +] // or -"eslintConfig": { - "extends": [ - "@codit/core", - "@codit/es5" - ] - } +"extends": [ + "@codit/eslint-config/core", + "@codit/eslint-config/es5" +] ``` ## Older versions diff --git a/flowtype.js b/flowtype.js deleted file mode 100644 index 63ed2a7..0000000 --- a/flowtype.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./packages/flowtype.json'); diff --git a/lodash.js b/lodash.js deleted file mode 100644 index 19d15f5..0000000 --- a/lodash.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./packages/lodash.json'); diff --git a/package.json b/package.json index 89fbe3e..03ca9e2 100644 --- a/package.json +++ b/package.json @@ -17,22 +17,22 @@ ], "author": "Erwin Govaerts ", "license": "MIT", + "dependencies": { + "@babel/eslint-parser": "^7.12.17", + "@typescript-eslint/parser": "^4.15.2", + "eslint-config-prettier": "^8.0.0" + }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^4.1.1", - "@typescript-eslint/parser": "^4.1.1", - "babel-eslint": "^10.0.3", - "eslint-config-prettier": "^6.9.0", - "eslint-plugin-babel": "^5.3.0", - "eslint-plugin-filenames": "^1.3.2", - "eslint-plugin-flowtype": "^4.5.3", - "eslint-plugin-import": "^2.22.0", - "eslint-plugin-lodash": "^6.0.0", - "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-react": "^7.17.0", - "eslint-plugin-react-hooks": "^4.1.2", - "typescript": "^4.0.3" + "typescript": "^4.1.2" }, "peerDependencies": { - "eslint": "^7.8.1" + "@babel/eslint-plugin": "^7.13.0", + "@typescript-eslint/eslint-plugin": "^4.15.2", + "eslint": "^7.20.0", + "eslint-plugin-filenames": "^1.3.2", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-promise": "^4.3.1", + "eslint-plugin-react": "^7.22.0", + "eslint-plugin-react-hooks": "^4.2.0" } } diff --git a/packages/base.json b/packages/base.json index 4f13c04..ae598bd 100644 --- a/packages/base.json +++ b/packages/base.json @@ -3,8 +3,6 @@ "./packages/core", "./packages/react", "./packages/typescript", - "prettier", - "prettier/@typescript-eslint", - "prettier/react" + "prettier" ] } diff --git a/packages/core.json b/packages/core.json index 9ee89be..44174dc 100644 --- a/packages/core.json +++ b/packages/core.json @@ -5,7 +5,7 @@ "es6": true, "node": true }, - "parser": "babel-eslint", + "parser": "@babel/eslint-parser", "parserOptions": { "ecmaFeatures": { "experimentalObjectRestSpread": true, @@ -16,7 +16,7 @@ "ecmaVersion": 2018, "sourceType": "module" }, - "plugins": ["babel", "import", "promise", "filenames"], + "plugins": ["@babel", "import", "promise", "filenames"], "rules": { "accessor-pairs": 2, "array-bracket-spacing": [2, "never"], @@ -31,9 +31,9 @@ "before": true } ], - "babel/new-cap": 1, - "babel/no-invalid-this": 2, - "babel/object-curly-spacing": [2, "always"], + "@babel/new-cap": 1, + "@babel/no-invalid-this": 2, + "@babel/object-curly-spacing": [2, "always"], "block-scoped-var": 2, "block-spacing": [2, "always"], "brace-style": [ diff --git a/packages/flowtype.json b/packages/flowtype.json deleted file mode 100644 index 7a23317..0000000 --- a/packages/flowtype.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "plugins": [ - "flowtype" - ], - "rules": { - "flowtype/boolean-style": [ - 2, - "boolean" - ], - "flowtype/define-flow-type": 1, - "flowtype/delimiter-dangle": [ - 2, - "always-multiline" - ], - "flowtype/generic-spacing": [ - 2, - "never" - ], - "flowtype/newline-after-flow-annotation": 0, - "flowtype/no-existential-type": 0, - "flowtype/no-flow-fix-me-comments": 0, - "flowtype/no-mutable-array": 0, - "flowtype/no-primitive-constructor-types": 1, - "flowtype/no-types-missing-file-annotation": 2, - "flowtype/no-unused-expressions": 1, - "flowtype/no-weak-types": 0, - "flowtype/object-type-delimiter": [ - 2, - "comma" - ], - "flowtype/require-exact-type": 0, - "flowtype/require-parameter-type": 1, - "flowtype/require-return-type": [ - 1, - "always", - { - "excludeMatching": [ - "render" - ] - } - ], - "flowtype/require-types-at-top": 0, - "flowtype/require-valid-file-annotation": 2, - "flowtype/require-variable-type": 0, - "flowtype/semi": [ - 2, - "always" - ], - "flowtype/sort-keys": [ - 0, - "asc", - { - "caseSensitive": true, - "natural": true - } - ], - "flowtype/space-after-type-colon": [ - 2, - "always" - ], - "flowtype/space-before-generic-bracket": [ - 2, - "never" - ], - "flowtype/space-before-type-colon": [ - 2, - "never" - ], - "flowtype/type-id-match": [ - 0, - "^([A-Z][a-z0-9]+Type)$" - ], - "flowtype/type-import-style": [ - 0, - "declaration" - ], - "flowtype/union-intersection-spacing": [ - 2, - "always" - ], - "flowtype/use-flow-type": 1 - }, - "settings": { - "flowtype": { - "onlyFilesWithFlowAnnotation": true - } - } -} \ No newline at end of file diff --git a/packages/lodash.json b/packages/lodash.json deleted file mode 100644 index 1b2dd21..0000000 --- a/packages/lodash.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "plugins": [ - "lodash" - ], - "rules": { - "lodash/callback-binding": 1, - "lodash/chain-style": [ - 1, - "implicit" - ], - "lodash/chaining": [ - 1, - "always" - ], - "lodash/collection-method-value": 2, - "lodash/collection-return": 2, - "lodash/consistent-compose": [ - 1, - "flow" - ], - "lodash/identity-shorthand": [ - 1, - "always" - ], - "lodash/import-scope": [ - 2, - "method" - ], - "lodash/matches-prop-shorthand": 1, - "lodash/matches-shorthand": [ - 1, - "always", - 3 - ], - "lodash/no-commit": 1, - "lodash/no-double-unwrap": 1, - "lodash/no-extra-args": 1, - "lodash/path-style": 0, - "lodash/prefer-compact": 1, - "lodash/prefer-constant": 0, - "lodash/prefer-filter": [ - 1, - 3 - ], - "lodash/prefer-find": 2, - "lodash/prefer-flat-map": 1, - "lodash/prefer-get": [ - 1, - 3 - ], - "lodash/prefer-immutable-method": 2, - "lodash/prefer-includes": 1, - "lodash/prefer-invoke-map": 1, - "lodash/prefer-is-nil": 1, - "lodash/prefer-lodash-chain": 1, - "lodash/prefer-lodash-method": 1, - "lodash/prefer-lodash-typecheck": 0, - "lodash/prefer-map": 2, - "lodash/prefer-matches": 1, - "lodash/prefer-noop": 0, - "lodash/prefer-over-quantifier": 0, - "lodash/prefer-reject": [ - 1, - 3 - ], - "lodash/prefer-startswith": 1, - "lodash/prefer-thru": 1, - "lodash/prefer-times": 1, - "lodash/prefer-wrapper-method": 1, - "lodash/preferred-alias": 1, - "lodash/prop-shorthand": 1, - "lodash/unwrap": 1 - } -} \ No newline at end of file diff --git a/packages/typescript.json b/packages/typescript.json index 0e340bc..fcc6d0f 100644 --- a/packages/typescript.json +++ b/packages/typescript.json @@ -1,5 +1,5 @@ { - "plugins": ["@typescript-eslint"], + "plugins": ["@typescript-eslint", "import"], "parser": "@typescript-eslint/parser", "parserOptions": { "project": "./tsconfig.json" diff --git a/typescript.js b/typescript.js new file mode 100644 index 0000000..37b86db --- /dev/null +++ b/typescript.js @@ -0,0 +1 @@ +module.exports = require("./packages/typescript.json");