From 5531bd0de62460a82c9d1c6095902af608f5844e Mon Sep 17 00:00:00 2001 From: Kevin Moot Date: Thu, 28 Apr 2016 11:06:34 -0500 Subject: [PATCH 01/14] Removing outdated/non-working eslint config. This will be replaced with a new eslint file reflecting the standards shortly. --- linters/.eslintrc | 5 - linters/.jshintrc | 62 ------ linters/README.md | 11 -- .../SublimeLinter.sublime-settings | 73 ------- packages/eslint-config-nerdery/.eslintrc | 8 - packages/eslint-config-nerdery/CHANGELOG.md | 178 ------------------ packages/eslint-config-nerdery/README.md | 45 ----- packages/eslint-config-nerdery/base.js | 7 - packages/eslint-config-nerdery/index.js | 8 - packages/eslint-config-nerdery/legacy.js | 20 -- packages/eslint-config-nerdery/package.json | 42 ----- .../rules/.eslintrc.json | 5 - .../rules/best-practices.js | 132 ------------- .../eslint-config-nerdery/rules/errors.js | 58 ------ packages/eslint-config-nerdery/rules/es6.js | 80 -------- .../eslint-config-nerdery/rules/legacy.js | 16 -- packages/eslint-config-nerdery/rules/node.js | 23 --- packages/eslint-config-nerdery/rules/react.js | 150 --------------- .../eslint-config-nerdery/rules/strict.js | 6 - packages/eslint-config-nerdery/rules/style.js | 144 -------------- .../eslint-config-nerdery/rules/variables.js | 32 ---- packages/eslint-config-nerdery/test/.eslintrc | 9 - .../eslint-config-nerdery/test/test-base.js | 30 --- .../test/test-react-order.js | 87 --------- 24 files changed, 1231 deletions(-) delete mode 100644 linters/.eslintrc delete mode 100644 linters/.jshintrc delete mode 100644 linters/README.md delete mode 100644 linters/SublimeLinter/SublimeLinter.sublime-settings delete mode 100644 packages/eslint-config-nerdery/.eslintrc delete mode 100644 packages/eslint-config-nerdery/CHANGELOG.md delete mode 100644 packages/eslint-config-nerdery/README.md delete mode 100644 packages/eslint-config-nerdery/base.js delete mode 100644 packages/eslint-config-nerdery/index.js delete mode 100644 packages/eslint-config-nerdery/legacy.js delete mode 100644 packages/eslint-config-nerdery/package.json delete mode 100644 packages/eslint-config-nerdery/rules/.eslintrc.json delete mode 100644 packages/eslint-config-nerdery/rules/best-practices.js delete mode 100644 packages/eslint-config-nerdery/rules/errors.js delete mode 100644 packages/eslint-config-nerdery/rules/es6.js delete mode 100644 packages/eslint-config-nerdery/rules/legacy.js delete mode 100644 packages/eslint-config-nerdery/rules/node.js delete mode 100644 packages/eslint-config-nerdery/rules/react.js delete mode 100644 packages/eslint-config-nerdery/rules/strict.js delete mode 100644 packages/eslint-config-nerdery/rules/style.js delete mode 100644 packages/eslint-config-nerdery/rules/variables.js delete mode 100644 packages/eslint-config-nerdery/test/.eslintrc delete mode 100644 packages/eslint-config-nerdery/test/test-base.js delete mode 100644 packages/eslint-config-nerdery/test/test-react-order.js diff --git a/linters/.eslintrc b/linters/.eslintrc deleted file mode 100644 index 5f6be34cf3..0000000000 --- a/linters/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -// Use this file as a starting point for your project's .eslintrc. -// Copy this file, and add rule overrides as needed. -{ - "extends": "nerdery" -} diff --git a/linters/.jshintrc b/linters/.jshintrc deleted file mode 100644 index 4d3468cb21..0000000000 --- a/linters/.jshintrc +++ /dev/null @@ -1,62 +0,0 @@ -{ - /* - * ENVIRONMENTS - * ================= - */ - - // Define globals exposed by modern browsers. - "browser": true, - - // Define globals exposed by jQuery. - "jquery": true, - - // Define globals exposed by Node.js. - "node": true, - - // Allow ES6. - "esnext": true, - - /* - * ENFORCING OPTIONS - * ================= - */ - - // Force all variable names to use either camelCase style or UPPER_CASE - // with underscores. - "camelcase": true, - - // Prohibit use of == and != in favor of === and !==. - "eqeqeq": true, - - // Enforce tab width of 2 spaces. - "indent": 2, - - // Prohibit use of a variable before it is defined. - "latedef": true, - - // Enforce line length to 100 characters - "maxlen": 100, - - // Require capitalized names for constructor functions. - "newcap": true, - - // Enforce use of single quotation marks for strings. - "quotmark": "single", - - // Enforce placing 'use strict' at the top function scope - "strict": true, - - // Prohibit use of explicitly undeclared variables. - "undef": true, - - // Warn when variables are defined but never used. - "unused": true, - - /* - * RELAXING OPTIONS - * ================= - */ - - // Suppress warnings about == null comparisons. - "eqnull": true -} diff --git a/linters/README.md b/linters/README.md deleted file mode 100644 index 39f1377e05..0000000000 --- a/linters/README.md +++ /dev/null @@ -1,11 +0,0 @@ -## `.eslintrc` - -Our `.eslintrc` requires the following NPM packages: - -``` -npm install --save-dev \ - eslint-config-nerdery \ - eslint \ - babel-eslint \ - eslint-plugin-react -``` diff --git a/linters/SublimeLinter/SublimeLinter.sublime-settings b/linters/SublimeLinter/SublimeLinter.sublime-settings deleted file mode 100644 index 8e513677c9..0000000000 --- a/linters/SublimeLinter/SublimeLinter.sublime-settings +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Nerdery JSHint settings for use with SublimeLinter and Sublime Text 2. - * - * 1. Install SublimeLinter at https://github.com/SublimeLinter/SublimeLinter - * 2. Open user preferences for the SublimeLinter package in Sublime Text 2 - * * For Mac OS X go to _Sublime Text 2_ > _Preferences_ > _Package Settings_ > _SublimeLinter_ > _Settings - User_ - * 3. Paste the contents of this file into your settings file - * 4. Save the settings file - * - * @version 0.3.0 - * @see https://github.com/SublimeLinter/SublimeLinter - * @see http://www.jshint.com/docs/ - */ -{ - "jshint_options": - { - /* - * ENVIRONMENTS - * ================= - */ - - // Define globals exposed by modern browsers. - "browser": true, - - // Define globals exposed by jQuery. - "jquery": true, - - // Define globals exposed by Node.js. - "node": true, - - /* - * ENFORCING OPTIONS - * ================= - */ - - // Force all variable names to use either camelCase style or UPPER_CASE - // with underscores. - "camelcase": true, - - // Prohibit use of == and != in favor of === and !==. - "eqeqeq": true, - - // Suppress warnings about == null comparisons. - "eqnull": true, - - // Enforce tab width of 2 spaces. - "indent": 2, - - // Prohibit use of a variable before it is defined. - "latedef": true, - - // Require capitalized names for constructor functions. - "newcap": true, - - // Enforce use of single quotation marks for strings. - "quotmark": "single", - - // Prohibit trailing whitespace. - "trailing": true, - - // Prohibit use of explicitly undeclared variables. - "undef": true, - - // Warn when variables are defined but never used. - "unused": true, - - // Enforce line length to 80 characters - "maxlen": 80, - - // Enforce placing 'use strict' at the top function scope - "strict": true - } -} diff --git a/packages/eslint-config-nerdery/.eslintrc b/packages/eslint-config-nerdery/.eslintrc deleted file mode 100644 index eb1143128e..0000000000 --- a/packages/eslint-config-nerdery/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "nerdery", - "rules": { - // disable requiring trailing commas because it might be nice to revert to - // being JSON at some point, and I don't want to make big changes now. - "comma-dangle": 0 - } -} diff --git a/packages/eslint-config-nerdery/CHANGELOG.md b/packages/eslint-config-nerdery/CHANGELOG.md deleted file mode 100644 index 774fad0795..0000000000 --- a/packages/eslint-config-nerdery/CHANGELOG.md +++ /dev/null @@ -1,178 +0,0 @@ -6.1.0 / 2016-02-22 -================== -- [new] enable [`react/prefer-stateless-function`][react/prefer-stateless-function] -- [dev deps] update `react-plugin-eslint`, `eslint`, `tape` - -6.0.2 / 2016-02-22 -================== -- [fix] disable [`no-confusing-arrow`][no-confusing-arrow] due to an `eslint` bug ([#752](https://github.com/airbnb/javascript/issues/752)) - -6.0.1 / 2016-02-21 -================== -- [fix] disable [`newline-per-chained-call`][newline-per-chained-call] due to an `eslint` bug ([#748](https://github.com/airbnb/javascript/issues/748)) - -6.0.0 / 2016-02-21 -================== -- [breaking] enable [`array-callback-return`][array-callback-return] -- [breaking] enable [`no-confusing-arrow`][no-confusing-arrow] -- [breaking] enable [`no-new-symbol`][no-new-symbol] -- [breaking] enable [`no-restricted-imports`][no-restricted-imports] -- [breaking] enable [`no-useless-constructor`][no-useless-constructor] -- [breaking] enable [`prefer-rest-params`][prefer-rest-params] -- [breaking] enable [`template-curly-spacing`][template-curly-spacing] -- [breaking] enable [`newline-per-chained-call`][newline-per-chained-call] -- [breaking] enable [`one-var-declaration-per-line`][one-var-declaration-per-line] -- [breaking] enable [`no-self-assign`][no-self-assign] -- [breaking] enable [`no-whitespace-before-property`][no-whitespace-before-property] -- [breaking] [react] enable [`react/jsx-space-before-closing`][react/jsx-space-before-closing] -- [breaking] [react] enable `static-methods` at top of [`react/sort-comp`][react/sort-comp] -- [breaking] [react] don't `ignoreTranspilerName` for [`react/display-name`][react/display-name] -- [peer+dev deps] update `eslint`, `eslint-plugin-react` ([#730](https://github.com/airbnb/javascript/issues/730)) - -5.0.1 / 2016-02-13 -================== -- [fix] `eslint` peerDep should not include breaking changes - -5.0.0 / 2016-02-03 -================== -- [breaking] disallow unneeded ternary expressions -- [breaking] Avoid lexical declarations in case/default clauses -- [dev deps] update `babel-tape-runner`, `eslint-plugin-react`, `react`, `tape` - -4.0.0 / 2016-01-22 -================== -- [breaking] require outer IIFE wrapping; flesh out guide section -- [minor] Add missing [`arrow-body-style`][arrow-body-style], [`prefer-template`][prefer-template] rules ([#678](https://github.com/airbnb/javascript/issues/678)) -- [minor] Add [`prefer-arrow-callback`][prefer-arrow-callback] to ES6 rules (to match the guide) ([#677](https://github.com/airbnb/javascript/issues/677)) -- [Tests] run `npm run lint` as part of tests; fix errors -- [Tests] use `parallelshell` to parallelize npm run-scripts - -3.1.0 / 2016-01-07 -================== -- [minor] Allow multiple stateless components in a single file - -3.0.2 / 2016-01-06 -================== -- [fix] Ignore URLs in [`max-len`][max-len] ([#664](https://github.com/airbnb/javascript/issues/664)) - -3.0.1 / 2016-01-06 -================== -- [fix] because we use babel, keywords should not be quoted - -3.0.0 / 2016-01-04 -================== -- [breaking] enable [`quote-props`][quote-props] rule ([#632](https://github.com/airbnb/javascript/issues/632)) -- [breaking] Define a max line length of 100 characters ([#639](https://github.com/airbnb/javascript/issues/639)) -- [breaking] [react] Minor cleanup for the React styleguide, add [`react/jsx-no-bind`][react/jsx-no-bind] ([#619](https://github.com/airbnb/javascript/issues/619)) -- [breaking] update best-practices config to prevent parameter object manipulation ([#627](https://github.com/airbnb/javascript/issues/627)) -- [minor] Enable [`react/no-is-mounted`][react/no-is-mounted] rule (#635, #633) -- [minor] Sort [`react/prefer-es6-class`][react/prefer-es6-class] alphabetically ([#634](https://github.com/airbnb/javascript/issues/634)) -- [minor] enable [`react/prefer-es6-class`][react/prefer-es6-class] rule -- Permit strict mode in "legacy" config -- [react] add missing rules from `eslint-plugin-react` (enforcing where necessary) ([#581](https://github.com/airbnb/javascript/issues/581)) -- [dev deps] update `eslint-plugin-react` - -2.1.1 / 2015-12-15 -================== -- [fix] Remove deprecated [`react/jsx-quotes`][react/jsx-quotes] ([#622](https://github.com/airbnb/javascript/issues/622)) - -2.1.0 / 2015-12-15 -================== -- [fix] use `require.resolve` to allow nested `extend`s ([#582](https://github.com/airbnb/javascript/issues/582)) -- [new] enable [`object-shorthand`][object-shorthand] rule ([#621](https://github.com/airbnb/javascript/issues/621)) -- [new] enable [`arrow-spacing`][arrow-spacing] rule ([#517](https://github.com/airbnb/javascript/issues/517)) -- [docs] flesh out react rule defaults ([#618](https://github.com/airbnb/javascript/issues/618)) - -2.0.0 / 2015-12-03 -================== -- [breaking] [`space-before-function-paren`][space-before-function-paren]: require function spacing: `function (` ([#605](https://github.com/airbnb/javascript/issues/605)) -- [breaking] [`indent`][indent]: Fix switch statement indentation rule ([#606](https://github.com/airbnb/javascript/issues/606)) -- [breaking] [`array-bracket-spacing`][array-bracket-spacing], [`computed-property-spacing`][computed-property-spacing]: disallow spacing inside brackets ([#594](https://github.com/airbnb/javascript/issues/594)) -- [breaking] [`object-curly-spacing`][object-curly-spacing]: require padding inside curly braces ([#594](https://github.com/airbnb/javascript/issues/594)) -- [breaking] [`space-in-parens`][space-in-parens]: disallow spaces in parens ([#594](https://github.com/airbnb/javascript/issues/594)) - -1.0.2 / 2015-11-25 -================== -- [breaking] [`no-multiple-empty-lines`][no-multiple-empty-lines]: only allow 1 blank line at EOF ([#578](https://github.com/airbnb/javascript/issues/578)) -- [new] `restParams`: enable rest params ([#592](https://github.com/airbnb/javascript/issues/592)) - -1.0.1 / 2015-11-25 -================== -- *erroneous publish* - -1.0.0 / 2015-11-08 -================== -- require `eslint` `v1.0.0` or higher -- remove `babel-eslint` dependency - -0.1.1 / 2015-11-05 -================== -- remove [`id-length`][id-length] rule ([#569](https://github.com/airbnb/javascript/issues/569)) -- enable [`no-mixed-spaces-and-tabs`][no-mixed-spaces-and-tabs] ([#539](https://github.com/airbnb/javascript/issues/539)) -- enable [`no-const-assign`][no-const-assign] ([#560](https://github.com/airbnb/javascript/issues/560)) -- enable [`space-before-keywords`][space-before-keywords] ([#554](https://github.com/airbnb/javascript/issues/554)) - -0.1.0 / 2015-11-05 -================== -- switch to modular rules files courtesy the [eslint-config-default][ecd] project and [@taion][taion]. [PR][pr-modular] -- export `eslint-config-airbnb/legacy` for ES5-only users. `eslint-config-airbnb/legacy` does not require the `babel-eslint` parser. [PR][pr-legacy] - -0.0.9 / 2015-09-24 -================== -- add rule [`no-undef`][no-undef] -- add rule [`id-length`][id-length] - -0.0.8 / 2015-08-21 -================== -- now has a changelog -- now is modular (see instructions above for with react and without react versions) - -0.0.7 / 2015-07-30 -================== -- TODO: fill in - - -[ecd]: https://github.com/walmartlabs/eslint-config-defaults -[taion]: https://github.com/taion -[pr-modular]: https://github.com/airbnb/javascript/pull/526 -[pr-legacy]: https://github.com/airbnb/javascript/pull/527 - -[array-bracket-spacing]: http://eslint.org/docs/rules/array-bracket-spacing -[array-callback-return]: http://eslint.org/docs/rules/array-callback-return -[arrow-body-style]: http://eslint.org/docs/rules/arrow-body-style -[arrow-spacing]: http://eslint.org/docs/rules/arrow-spacing -[computed-property-spacing]: http://eslint.org/docs/rules/computed-property-spacing -[id-length]: http://eslint.org/docs/rules/id-length -[indent]: http://eslint.org/docs/rules/indent -[max-len]: http://eslint.org/docs/rules/max-len -[newline-per-chained-call]: http://eslint.org/docs/rules/newline-per-chained-call -[no-confusing-arrow]: http://eslint.org/docs/rules/no-confusing-arrow -[no-const-assign]: http://eslint.org/docs/rules/no-const-assign -[no-mixed-spaces-and-tabs]: http://eslint.org/docs/rules/no-mixed-spaces-and-tabs -[no-multiple-empty-lines]: http://eslint.org/docs/rules/no-multiple-empty-lines -[no-new-symbol]: http://eslint.org/docs/rules/no-new-symbol -[no-restricted-imports]: http://eslint.org/docs/rules/no-restricted-imports -[no-self-assign]: http://eslint.org/docs/rules/no-self-assign -[no-undef]: http://eslint.org/docs/rules/no-undef -[no-useless-constructor]: http://eslint.org/docs/rules/no-useless-constructor -[no-whitespace-before-property]: http://eslint.org/docs/rules/no-whitespace-before-property -[object-curly-spacing]: http://eslint.org/docs/rules/object-curly-spacing -[object-shorthand]: http://eslint.org/docs/rules/object-shorthand -[one-var-declaration-per-line]: http://eslint.org/docs/rules/one-var-declaration-per-line -[prefer-arrow-callback]: http://eslint.org/docs/rules/prefer-arrow-callback -[prefer-rest-params]: http://eslint.org/docs/rules/prefer-rest-params -[prefer-template]: http://eslint.org/docs/rules/prefer-template -[quote-props]: http://eslint.org/docs/rules/quote-props -[space-before-function-paren]: http://eslint.org/docs/rules/space-before-function-paren -[space-before-keywords]: http://eslint.org/docs/rules/space-before-keywords -[space-in-parens]: http://eslint.org/docs/rules/space-in-parens -[template-curly-spacing]: http://eslint.org/docs/rules/template-curly-spacing - -[react/jsx-space-before-closing]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md -[react/sort-comp]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md -[react/display-name]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md -[react/jsx-no-bind]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md -[react/no-is-mounted]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md -[react/prefer-es6-class]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md -[react/jsx-quotes]: https://github.com/yannickcr/eslint-plugin-react/blob/f817e37beddddc84b4788969f07c524fa7f0823b/docs/rules/jsx-quotes.md -[react/prefer-stateless-function]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md diff --git a/packages/eslint-config-nerdery/README.md b/packages/eslint-config-nerdery/README.md deleted file mode 100644 index 73f7af8eab..0000000000 --- a/packages/eslint-config-nerdery/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# eslint-config-nerdery - -[![npm version](https://badge.fury.io/js/eslint-config-nerdery.svg)](http://badge.fury.io/js/eslint-config-nerdery) - -This package provides the Nerdery's .eslintrc as an extensible shared config. - -## Usage - -We export three ESLint configurations for your usage. - -### eslint-config-nerdery - -Our default export contains all of our ESLint rules, including EcmaScript 6+ -and React. It requires `eslint` and `eslint-plugin-react`. - -1. `npm install --save-dev eslint-config-nerdery eslint-plugin-react eslint` -2. add `"extends": "nerdery"` to your .eslintrc - -### eslint-config-nerdery/base - -Lints ES6+ but does not lint React. Requires `eslint`. - -1. `npm install --save-dev eslint-config-nerdery eslint` -2. add `"extends": "nerdery/base"` to your .eslintrc - -### eslint-config-nerdery/legacy - -Lints ES5 and below. Only requires `eslint`. - -1. `npm install --save-dev eslint-config-nerdery eslint` -2. add `"extends": "nerdery/legacy"` to your .eslintrc - -See [Nerdery's Javascript styleguide](https://github.com/thenerdery/javascript-standards) and -the [ESlint config docs](http://eslint.org/docs/user-guide/configuring#extending-configuration-files) -for more information. - -## Improving this config - -Consider adding test cases if you're making complicated rules changes, like -anything involving regexes. Perhaps in a distant future, we could use literate -programming to structure our README as test cases for our .eslintrc? - -You can run tests with `npm test`. - -You can make sure this module lints with itself using `npm run lint`. diff --git a/packages/eslint-config-nerdery/base.js b/packages/eslint-config-nerdery/base.js deleted file mode 100644 index 9c7c62f523..0000000000 --- a/packages/eslint-config-nerdery/base.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - extends: [ - 'eslint-config-nerdery/legacy', - 'eslint-config-nerdery/rules/es6', - ].map(require.resolve), - rules: {} -}; diff --git a/packages/eslint-config-nerdery/index.js b/packages/eslint-config-nerdery/index.js deleted file mode 100644 index ea1ae9cd9a..0000000000 --- a/packages/eslint-config-nerdery/index.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - extends: [ - 'eslint-config-nerdery/base', - 'eslint-config-nerdery/rules/strict', - 'eslint-config-nerdery/rules/react', - ].map(require.resolve), - rules: {} -}; diff --git a/packages/eslint-config-nerdery/legacy.js b/packages/eslint-config-nerdery/legacy.js deleted file mode 100644 index 6f8c06df7e..0000000000 --- a/packages/eslint-config-nerdery/legacy.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - extends: [ - 'eslint-config-nerdery/rules/best-practices', - 'eslint-config-nerdery/rules/errors', - 'eslint-config-nerdery/rules/legacy', - 'eslint-config-nerdery/rules/node', - 'eslint-config-nerdery/rules/style', - 'eslint-config-nerdery/rules/variables' - ].map(require.resolve), - env: { - browser: true, - node: true, - amd: false, - mocha: false, - jasmine: false - }, - ecmaFeatures: {}, - globals: {}, - rules: {} -}; diff --git a/packages/eslint-config-nerdery/package.json b/packages/eslint-config-nerdery/package.json deleted file mode 100644 index 3c4bea045a..0000000000 --- a/packages/eslint-config-nerdery/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "eslint-config-nerdery", - "version": "6.1.0", - "description": "Nerdery's ESLint config, following our styleguide", - "main": "index.js", - "scripts": { - "lint": "eslint .", - "tests-only": "babel-tape-runner ./test/test-*.js", - "test": "parallelshell 'npm run lint' 'npm run tests-only'" - }, - "repository": { - "type": "git", - "url": "https://github.com/thenerdery/javascript-standards" - }, - "keywords": [ - "eslint", - "eslintconfig", - "config", - "nerdery", - "javascript", - "styleguide" - ], - "author": "", - "contributors": [], - "license": "MIT", - "bugs": { - "url": "https://github.com/thenerdery/javascript-standards/issues" - }, - "homepage": "https://github.com/thenerdery/javascript-standards", - "devDependencies": { - "babel-tape-runner": "^1.3.1", - "eslint": "^2.4.0", - "eslint-plugin-react": "^4.2.1", - "react": "^0.14.7", - "tape": "^4.5.1", - "parallelshell": "^2.0.0" - }, - "peerDependencies": { - "eslint": "^2.2.0", - "eslint-plugin-react": "^4.0.0" - } -} diff --git a/packages/eslint-config-nerdery/rules/.eslintrc.json b/packages/eslint-config-nerdery/rules/.eslintrc.json deleted file mode 100644 index de68aa25ca..0000000000 --- a/packages/eslint-config-nerdery/rules/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "quote-props": 0 - } -} diff --git a/packages/eslint-config-nerdery/rules/best-practices.js b/packages/eslint-config-nerdery/rules/best-practices.js deleted file mode 100644 index ff782a5b7a..0000000000 --- a/packages/eslint-config-nerdery/rules/best-practices.js +++ /dev/null @@ -1,132 +0,0 @@ -module.exports = { - 'rules': { - // enforces getter/setter pairs in objects - 'accessor-pairs': 0, - // enforces return statements in callbacks of array's methods - // http://eslint.org/docs/rules/array-callback-return - 'array-callback-return': 2, - // treat var statements as if they were block scoped - 'block-scoped-var': 2, - // specify the maximum cyclomatic complexity allowed in a program - 'complexity': [0, 11], - // require return statements to either always or never specify values - 'consistent-return': 2, - // specify curly brace conventions for all control statements - 'curly': [2, 'multi-line'], - // require default case in switch statements - 'default-case': 2, - // encourages use of dot notation whenever possible - 'dot-notation': [2, { 'allowKeywords': true }], - // enforces consistent newlines before or after dots - 'dot-location': 0, - // require the use of === and !== - 'eqeqeq': 2, - // make sure for-in loops have an if statement - 'guard-for-in': 2, - // Blacklist certain identifiers to prevent them being used - // http://eslint.org/docs/rules/id-blacklist - 'id-blacklist': 0, - // disallow the use of alert, confirm, and prompt - 'no-alert': 1, - // disallow use of arguments.caller or arguments.callee - 'no-caller': 2, - // disallow lexical declarations in case/default clauses - // http://eslint.org/docs/rules/no-case-declarations.html - 'no-case-declarations': 2, - // disallow division operators explicitly at beginning of regular expression - 'no-div-regex': 0, - // disallow else after a return in an if - 'no-else-return': 2, - // disallow Unnecessary Labels - // http://eslint.org/docs/rules/no-extra-label - 'no-extra-label': 2, - // disallow comparisons to null without a type-checking operator - 'no-eq-null': 0, - // disallow use of eval() - 'no-eval': 2, - // disallow adding to native types - 'no-extend-native': 2, - // disallow unnecessary function binding - 'no-extra-bind': 2, - // disallow fallthrough of case statements - 'no-fallthrough': 2, - // disallow the use of leading or trailing decimal points in numeric literals - 'no-floating-decimal': 2, - // disallow the type conversions with shorter notations - 'no-implicit-coercion': 0, - // disallow use of eval()-like methods - 'no-implied-eval': 2, - // disallow this keywords outside of classes or class-like objects - 'no-invalid-this': 0, - // disallow usage of __iterator__ property - 'no-iterator': 2, - // disallow use of labels for anything other then loops and switches - 'no-labels': [2, { 'allowLoop': false, 'allowSwitch': false }], - // disallow unnecessary nested blocks - 'no-lone-blocks': 2, - // disallow creation of functions within loops - 'no-loop-func': 2, - // disallow use of multiple spaces - 'no-multi-spaces': 2, - // disallow use of multiline strings - 'no-multi-str': 2, - // disallow reassignments of native objects - 'no-native-reassign': 2, - // disallow use of new operator when not part of the assignment or comparison - 'no-new': 2, - // disallow use of new operator for Function object - 'no-new-func': 2, - // disallows creating new instances of String, Number, and Boolean - 'no-new-wrappers': 2, - // disallow use of (old style) octal literals - 'no-octal': 2, - // disallow use of octal escape sequences in string literals, such as - // var foo = 'Copyright \251'; - 'no-octal-escape': 2, - // disallow reassignment of function parameters - // disallow parameter object manipulation - // rule: http://eslint.org/docs/rules/no-param-reassign.html - 'no-param-reassign': [2, { 'props': true }], - // disallow use of process.env - 'no-process-env': 0, - // disallow usage of __proto__ property - 'no-proto': 2, - // disallow declaring the same variable more then once - 'no-redeclare': 2, - // disallow use of assignment in return statement - 'no-return-assign': 2, - // disallow use of `javascript:` urls. - 'no-script-url': 2, - // disallow comparisons where both sides are exactly the same - 'no-self-compare': 2, - // disallow use of comma operator - 'no-sequences': 2, - // restrict what can be thrown as an exception - 'no-throw-literal': 2, - // disallow unmodified conditions of loops - // http://eslint.org/docs/rules/no-unmodified-loop-condition - 'no-unmodified-loop-condition': 0, - // disallow usage of expressions in statement position - 'no-unused-expressions': 2, - // disallow unused labels - // http://eslint.org/docs/rules/no-unused-labels - 'no-unused-labels': 2, - // disallow unnecessary .call() and .apply() - 'no-useless-call': 0, - // disallow use of void operator - 'no-void': 0, - // disallow usage of configurable warning terms in comments: e.g. todo - 'no-warning-comments': [0, { 'terms': ['todo', 'fixme', 'xxx'], 'location': 'start' }], - // disallow use of the with statement - 'no-with': 2, - // require use of the second argument for parseInt() - 'radix': 2, - // requires to declare all vars on top of their containing scope - 'vars-on-top': 2, - // require immediate function invocation to be wrapped in parentheses - // http://eslint.org/docs/rules/wrap-iife.html - 'wrap-iife': [2, 'outside'], - // require or disallow Yoda conditions - 'yoda': 2 - } -}; diff --git a/packages/eslint-config-nerdery/rules/errors.js b/packages/eslint-config-nerdery/rules/errors.js deleted file mode 100644 index 1c1addf5fa..0000000000 --- a/packages/eslint-config-nerdery/rules/errors.js +++ /dev/null @@ -1,58 +0,0 @@ -module.exports = { - 'rules': { - // disallow assignment in conditional expressions - 'no-cond-assign': [2, 'always'], - // disallow use of console - 'no-console': 1, - // disallow use of constant expressions in conditions - 'no-constant-condition': 1, - // disallow control characters in regular expressions - 'no-control-regex': 2, - // disallow use of debugger - 'no-debugger': 1, - // disallow duplicate arguments in functions - 'no-dupe-args': 2, - // disallow duplicate keys when creating object literals - 'no-dupe-keys': 2, - // disallow a duplicate case label. - 'no-duplicate-case': 2, - // disallow the use of empty character classes in regular expressions - 'no-empty-character-class': 2, - // disallow empty statements - 'no-empty': 2, - // disallow assigning to the exception in a catch block - 'no-ex-assign': 2, - // disallow double-negation boolean casts in a boolean context - 'no-extra-boolean-cast': 0, - // disallow unnecessary parentheses - 'no-extra-parens': [2, 'functions'], - // disallow unnecessary semicolons - 'no-extra-semi': 2, - // disallow overwriting functions written as function declarations - 'no-func-assign': 2, - // disallow function or variable declarations in nested blocks - 'no-inner-declarations': 2, - // disallow invalid regular expression strings in the RegExp constructor - 'no-invalid-regexp': 2, - // disallow irregular whitespace outside of strings and comments - 'no-irregular-whitespace': 2, - // disallow negation of the left operand of an in expression - 'no-negated-in-lhs': 2, - // disallow the use of object properties of the global object (Math and JSON) as functions - 'no-obj-calls': 2, - // disallow multiple spaces in a regular expression literal - 'no-regex-spaces': 2, - // disallow sparse arrays - 'no-sparse-arrays': 2, - // disallow unreachable statements after a return, throw, continue, or break statement - 'no-unreachable': 2, - // disallow comparisons with the value NaN - 'use-isnan': 2, - // ensure JSDoc comments are valid - 'valid-jsdoc': 0, - // ensure that the results of typeof are compared against a valid string - 'valid-typeof': 2, - // Avoid code that looks like two expressions but is actually one - 'no-unexpected-multiline': 0 - } -}; diff --git a/packages/eslint-config-nerdery/rules/es6.js b/packages/eslint-config-nerdery/rules/es6.js deleted file mode 100644 index d0b7bbde9f..0000000000 --- a/packages/eslint-config-nerdery/rules/es6.js +++ /dev/null @@ -1,80 +0,0 @@ -module.exports = { - 'env': { - 'es6': true - }, - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module', - 'ecmaFeatures': { - 'jsx': true, - 'generators': false, - 'objectLiteralDuplicateProperties': false - } - }, - 'rules': { - // enforces no braces where they can be omitted - // http://eslint.org/docs/rules/arrow-body-style - 'arrow-body-style': [2, 'as-needed'], - // require parens in arrow function arguments - 'arrow-parens': 0, - // require space before/after arrow function's arrow - // https://github.com/eslint/eslint/blob/master/docs/rules/arrow-spacing.md - 'arrow-spacing': [2, { 'before': true, 'after': true }], - // require trailing commas in multiline object literals - 'comma-dangle': [2, 'always-multiline'], - // verify super() callings in constructors - 'constructor-super': 0, - // enforce the spacing around the * in generator functions - 'generator-star-spacing': 0, - // disallow modifying variables of class declarations - 'no-class-assign': 0, - // disallow arrow functions where they could be confused with comparisons - // http://eslint.org/docs/rules/no-confusing-arrow - 'no-confusing-arrow': 0, - // disallow modifying variables that are declared using const - 'no-const-assign': 2, - // disallow symbol constructor - // http://eslint.org/docs/rules/no-new-symbol - 'no-new-symbol': 2, - // disallow specific globals - 'no-restricted-globals': 0, - // disallow specific imports - // http://eslint.org/docs/rules/no-restricted-imports - 'no-restricted-imports': 0, - // disallow to use this/super before super() calling in constructors. - 'no-this-before-super': 0, - // require let or const instead of var - 'no-var': 2, - // disallow unnecessary constructor - // http://eslint.org/docs/rules/no-useless-constructor - 'no-useless-constructor': 2, - // require method and property shorthand syntax for object literals - // https://github.com/eslint/eslint/blob/master/docs/rules/object-shorthand.md - 'object-shorthand': [2, 'always'], - // suggest using arrow functions as callbacks - 'prefer-arrow-callback': 2, - // suggest using of const declaration for variables that are never modified after declared - 'prefer-const': 2, - // suggest using the spread operator instead of .apply() - 'prefer-spread': 0, - // suggest using Reflect methods where applicable - 'prefer-reflect': 0, - // use rest parameters instead of arguments - // http://eslint.org/docs/rules/prefer-rest-params - 'prefer-rest-params': 2, - // suggest using template literals instead of string concatenation - // http://eslint.org/docs/rules/prefer-template - 'prefer-template': 2, - // disallow generator functions that do not have yield - 'require-yield': 0, - // import sorting - // http://eslint.org/docs/rules/sort-imports - 'sort-imports': 0, - // enforce usage of spacing in template strings - // http://eslint.org/docs/rules/template-curly-spacing - 'template-curly-spacing': 2, - // enforce spacing around the * in yield* expressions - // http://eslint.org/docs/rules/yield-star-spacing - 'yield-star-spacing': [2, 'after'] - } -}; diff --git a/packages/eslint-config-nerdery/rules/legacy.js b/packages/eslint-config-nerdery/rules/legacy.js deleted file mode 100644 index dc34856f5e..0000000000 --- a/packages/eslint-config-nerdery/rules/legacy.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - 'rules': { - // disallow trailing commas in object literals - 'comma-dangle': [2, 'never'], - // specify the maximum depth that blocks can be nested - 'max-depth': [0, 4], - // limits the number of parameters that can be used in the function declaration. - 'max-params': [0, 3], - // specify the maximum number of statement allowed in a function - 'max-statements': [0, 10], - // disallow use of bitwise operators - 'no-bitwise': 0, - // disallow use of unary operators, ++ and -- - 'no-plusplus': 0 - } -}; diff --git a/packages/eslint-config-nerdery/rules/node.js b/packages/eslint-config-nerdery/rules/node.js deleted file mode 100644 index 16b6f20d45..0000000000 --- a/packages/eslint-config-nerdery/rules/node.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - 'env': { - 'node': true - }, - 'rules': { - // enforce return after a callback - 'callback-return': 0, - // enforces error handling in callbacks (node environment) - 'handle-callback-err': 0, - // disallow mixing regular variable and require declarations - 'no-mixed-requires': [0, false], - // disallow use of new operator with the require function - 'no-new-require': 0, - // disallow string concatenation with __dirname and __filename - 'no-path-concat': 0, - // disallow process.exit() - 'no-process-exit': 0, - // restrict usage of specified node modules - 'no-restricted-modules': 0, - // disallow use of synchronous methods (off by default) - 'no-sync': 0 - } -}; diff --git a/packages/eslint-config-nerdery/rules/react.js b/packages/eslint-config-nerdery/rules/react.js deleted file mode 100644 index a5d0d17de2..0000000000 --- a/packages/eslint-config-nerdery/rules/react.js +++ /dev/null @@ -1,150 +0,0 @@ -module.exports = { - 'plugins': [ - 'react' - ], - 'ecmaFeatures': { - 'jsx': true - }, - // View link below for react rules documentation - // https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules - 'rules': { - // Prevent missing displayName in a React component definition - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md - 'react/display-name': [0, { 'ignoreTranspilerName': false }], - // Forbid certain propTypes (any, array, object) - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md - 'react/forbid-prop-types': [0, { 'forbid': ['any', 'array', 'object'] }], - // Enforce boolean attributes notation in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md - 'react/jsx-boolean-value': [2, 'never'], - // Validate closing bracket location in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md - 'react/jsx-closing-bracket-location': [2, 'line-aligned'], - // Enforce or disallow spaces inside of curly braces in JSX attributes - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md - 'react/jsx-curly-spacing': [0, 'never', { 'allowMultiline': true }], - // Enforce event handler naming conventions in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md - 'react/jsx-handler-names': [0, { - 'eventHandlerPrefix': 'handle', - 'eventHandlerPropPrefix': 'on', - }], - // Validate props indentation in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md - 'react/jsx-indent-props': [2, 2], - // Validate JSX has key prop when in array or iterator - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md - 'react/jsx-key': 0, - // Limit maximum of props on a single line in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md - 'react/jsx-max-props-per-line': [0, { 'maximum': 1 }], - // Prevent usage of .bind() and arrow functions in JSX props - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md - 'react/jsx-no-bind': [2, { - 'ignoreRefs': false, - 'allowArrowFunctions': false, - 'allowBind': false, - }], - // Prevent duplicate props in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md - 'react/jsx-no-duplicate-props': [0, { 'ignoreCase': false }], - // Prevent usage of unwrapped JSX strings - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md - 'react/jsx-no-literals': 0, - // Disallow undeclared variables in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md - 'react/jsx-no-undef': 2, - // Enforce PascalCase for user-defined JSX components - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md - 'react/jsx-pascal-case': 0, - // Enforce propTypes declarations alphabetical sorting - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md - 'react/sort-prop-types': [0, { - 'ignoreCase': false, - 'callbacksLast': false, - }], - // Enforce props alphabetical sorting - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md - 'react/jsx-sort-props': [0, { - 'ignoreCase': false, - 'callbacksLast': false, - }], - // Prevent React to be incorrectly marked as unused - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md - 'react/jsx-uses-react': [2, { 'pragma': 'React' }], - // Prevent variables used in JSX to be incorrectly marked as unused - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md - 'react/jsx-uses-vars': 2, - // Prevent usage of dangerous JSX properties - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md - 'react/no-danger': 0, - // Prevent usage of deprecated methods - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md - 'react/no-deprecated': [1, { 'react': '0.14.0' }], - // Prevent usage of setState in componentDidMount - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md - 'react/no-did-mount-set-state': [2, 'allow-in-func'], - // Prevent usage of setState in componentDidUpdate - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md - 'react/no-did-update-set-state': [2, 'allow-in-func'], - // Prevent direct mutation of this.state - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md - 'react/no-direct-mutation-state': 0, - // Prevent usage of isMounted - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md - 'react/no-is-mounted': 2, - // Prevent multiple component definition per file - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md - 'react/no-multi-comp': [2, { 'ignoreStateless': true }], - // Prevent usage of setState - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md - 'react/no-set-state': 0, - // Prevent using string references - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md - 'react/no-string-refs': 0, - // Prevent usage of unknown DOM property - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md - 'react/no-unknown-property': 2, - // Require ES6 class declarations over React.createClass - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md - 'react/prefer-es6-class': [2, 'always'], - // Require stateless functions when not using lifecycle methods, setState or ref - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md - 'react/prefer-stateless-function': 2, - // Prevent missing props validation in a React component definition - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md - 'react/prop-types': [2, { 'ignore': [], 'customValidators': [] }], - // Prevent missing React when using JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md - 'react/react-in-jsx-scope': 2, - // Restrict file extensions that may be required - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-extension.md - 'react/require-extension': [0, { 'extensions': ['.jsx'] }], - // Prevent extra closing tags for components without children - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md - 'react/self-closing-comp': 2, - // Enforce spaces before the closing bracket of self-closing JSX elements - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md - 'react/jsx-space-before-closing': [2, 'always'], - // Enforce component methods order - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md - 'react/sort-comp': [2, { - 'order': [ - 'static-methods', - 'lifecycle', - '/^on.+$/', - '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', - 'everything-else', - '/^render.+$/', - 'render' - ] - }], - // Prevent missing parentheses around multilines JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md - 'react/wrap-multilines': [2, { - declaration: true, - assignment: true, - return: true - }], - } -}; diff --git a/packages/eslint-config-nerdery/rules/strict.js b/packages/eslint-config-nerdery/rules/strict.js deleted file mode 100644 index 6d32f8ca59..0000000000 --- a/packages/eslint-config-nerdery/rules/strict.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - 'rules': { - // babel inserts `'use strict';` for us - 'strict': [2, 'never'] - } -}; diff --git a/packages/eslint-config-nerdery/rules/style.js b/packages/eslint-config-nerdery/rules/style.js deleted file mode 100644 index d811f8851f..0000000000 --- a/packages/eslint-config-nerdery/rules/style.js +++ /dev/null @@ -1,144 +0,0 @@ -module.exports = { - 'rules': { - // enforce spacing inside array brackets - 'array-bracket-spacing': [2, 'never'], - // enforce one true brace style - 'brace-style': [2, '1tbs', { 'allowSingleLine': true }], - // require camel case names - 'camelcase': [2, { 'properties': 'never' }], - // enforce spacing before and after comma - 'comma-spacing': [2, { 'before': false, 'after': true }], - // enforce one true comma style - 'comma-style': [2, 'last'], - // disallow padding inside computed properties - 'computed-property-spacing': [2, 'never'], - // enforces consistent naming when capturing the current execution context - 'consistent-this': 0, - // enforce newline at the end of file, with no multiple empty lines - 'eol-last': 2, - // require function expressions to have a name - 'func-names': 1, - // enforces use of function declarations or expressions - 'func-style': 0, - // this option enforces minimum and maximum identifier lengths - // (variable names, property names etc.) - 'id-length': 0, - // this option sets a specific tab width for your code - // https://github.com/eslint/eslint/blob/master/docs/rules/indent.md - 'indent': [2, 2, { 'SwitchCase': 1, 'VariableDeclarator': 1 }], - // specify whether double or single quotes should be used in JSX attributes - // http://eslint.org/docs/rules/jsx-quotes - 'jsx-quotes': [2, 'prefer-double'], - // enforces spacing between keys and values in object literal properties - 'key-spacing': [2, { 'beforeColon': false, 'afterColon': true }], - // require a space before & after certain keywords - 'keyword-spacing': [2, { - 'before': true, - 'after': true, - 'overrides': { - 'return': { 'after': true }, - 'throw': { 'after': true }, - 'case': { 'after': true } - } - }], - // enforces empty lines around comments - 'lines-around-comment': 0, - // disallow mixed 'LF' and 'CRLF' as linebreaks - 'linebreak-style': 0, - // specify the maximum length of a line in your program - // https://github.com/eslint/eslint/blob/master/docs/rules/max-len.md - 'max-len': [2, 100, 2, { - 'ignoreUrls': true, - 'ignoreComments': false - }], - // specify the maximum depth callbacks can be nested - 'max-nested-callbacks': 0, - // require a capital letter for constructors - 'new-cap': [2, { 'newIsCap': true }], - // disallow the omission of parentheses when invoking a constructor with no arguments - 'new-parens': 0, - // allow/disallow an empty newline after var statement - 'newline-after-var': 0, - // http://eslint.org/docs/rules/newline-before-return - 'newline-before-return': 0, - // enforces new line after each method call in the chain to make it - // more readable and easy to maintain - // http://eslint.org/docs/rules/newline-per-chained-call - 'newline-per-chained-call': [0, { 'ignoreChainWithDepth': 3 }], - // disallow use of the Array constructor - 'no-array-constructor': 2, - // disallow use of the continue statement - 'no-continue': 0, - // disallow comments inline after code - 'no-inline-comments': 0, - // disallow if as the only statement in an else block - 'no-lonely-if': 0, - // disallow mixed spaces and tabs for indentation - 'no-mixed-spaces-and-tabs': 2, - // disallow multiple empty lines and only one newline at the end - 'no-multiple-empty-lines': [2, { 'max': 2, 'maxEOF': 1 }], - // disallow nested ternary expressions - 'no-nested-ternary': 2, - // disallow use of the Object constructor - 'no-new-object': 2, - // disallow space between function identifier and application - 'no-spaced-func': 2, - // disallow the use of ternary operators - 'no-ternary': 0, - // disallow trailing whitespace at the end of lines - 'no-trailing-spaces': 2, - // disallow dangling underscores in identifiers - 'no-underscore-dangle': 0, - // disallow the use of Boolean literals in conditional expressions - // also, prefer `a || b` over `a ? a : b` - // http://eslint.org/docs/rules/no-unneeded-ternary - 'no-unneeded-ternary': [2, { 'defaultAssignment': false }], - // disallow whitespace before properties - // http://eslint.org/docs/rules/no-whitespace-before-property - 'no-whitespace-before-property': 2, - // require padding inside curly braces - 'object-curly-spacing': [2, 'always'], - // allow just one var statement per function - 'one-var': [2, 'never'], - // require a newline around variable declaration - // http://eslint.org/docs/rules/one-var-declaration-per-line - 'one-var-declaration-per-line': [2, 'always'], - // require assignment operator shorthand where possible or prohibit it entirely - 'operator-assignment': 0, - // enforce operators to be placed before or after line breaks - 'operator-linebreak': 0, - // enforce padding within blocks - 'padded-blocks': [2, 'never'], - // require quotes around object literal property names - // http://eslint.org/docs/rules/quote-props.html - 'quote-props': [2, 'as-needed', { 'keywords': false, 'unnecessary': true, 'numbers': false }], - // specify whether double or single quotes should be used - 'quotes': [2, 'single', 'avoid-escape'], - // require identifiers to match the provided regular expression - 'id-match': 0, - // enforce spacing before and after semicolons - 'semi-spacing': [2, { 'before': false, 'after': true }], - // require or disallow use of semicolons instead of ASI - 'semi': [2, 'always'], - // sort variables within the same declaration block - 'sort-vars': 0, - // require or disallow space before blocks - 'space-before-blocks': 2, - // require or disallow space before function opening parenthesis - // https://github.com/eslint/eslint/blob/master/docs/rules/space-before-function-paren.md - 'space-before-function-paren': [2, { 'anonymous': 'always', 'named': 'never' }], - // require or disallow spaces inside parentheses - 'space-in-parens': [2, 'never'], - // require spaces around operators - 'space-infix-ops': 2, - // Require or disallow spaces before/after unary operators - 'space-unary-ops': 0, - // require or disallow a space immediately following the // or /* in a comment - 'spaced-comment': [2, 'always', { - 'exceptions': ['-', '+'], - 'markers': ['=', '!'] // space here to support sprockets directives - }], - // require regex literals to be wrapped in parentheses - 'wrap-regex': 0 - } -}; diff --git a/packages/eslint-config-nerdery/rules/variables.js b/packages/eslint-config-nerdery/rules/variables.js deleted file mode 100644 index 3bfcc83fde..0000000000 --- a/packages/eslint-config-nerdery/rules/variables.js +++ /dev/null @@ -1,32 +0,0 @@ -module.exports = { - 'rules': { - // enforce or disallow variable initializations at definition - 'init-declarations': 0, - // disallow the catch clause parameter name being the same as a variable in the outer scope - 'no-catch-shadow': 0, - // disallow deletion of variables - 'no-delete-var': 2, - // disallow var and named functions in global scope - // http://eslint.org/docs/rules/no-implicit-globals - 'no-implicit-globals': 0, - // disallow labels that share a name with a variable - 'no-label-var': 0, - // disallow self assignment - // http://eslint.org/docs/rules/no-self-assign - 'no-self-assign': 2, - // disallow shadowing of names such as arguments - 'no-shadow-restricted-names': 2, - // disallow declaration of variables already declared in the outer scope - 'no-shadow': 2, - // disallow use of undefined when initializing variables - 'no-undef-init': 0, - // disallow use of undeclared variables unless mentioned in a /*global */ block - 'no-undef': 2, - // disallow use of undefined variable - 'no-undefined': 0, - // disallow declaration of variables that are not used in the code - 'no-unused-vars': [2, { 'vars': 'local', 'args': 'after-used' }], - // disallow use of variables before they are defined - 'no-use-before-define': 2 - } -}; diff --git a/packages/eslint-config-nerdery/test/.eslintrc b/packages/eslint-config-nerdery/test/.eslintrc deleted file mode 100644 index 7f79874e41..0000000000 --- a/packages/eslint-config-nerdery/test/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "rules": { - // disabled because I find it tedious to write tests while following this - // rule - "no-shadow": 0, - // tests uses `t` for tape - "id-length": [2, {"min": 2, "properties": "never", "exceptions": ["t"]}] - } -} diff --git a/packages/eslint-config-nerdery/test/test-base.js b/packages/eslint-config-nerdery/test/test-base.js deleted file mode 100644 index 24aa884cd0..0000000000 --- a/packages/eslint-config-nerdery/test/test-base.js +++ /dev/null @@ -1,30 +0,0 @@ -import fs from 'fs'; -import path from 'path'; -import test from 'tape'; - -const files = { - base: require('../base') -}; - -fs.readdirSync(path.join(__dirname, '../rules')).forEach(name => { - if (name === 'react.js') { - return; - } - - files[name] = require(`../rules/${name}`); -}); - -Object.keys(files).forEach(name => { - const config = files[name]; - - test(`${name}: does not reference react`, t => { - t.plan(2); - - t.notOk(config.plugins, 'plugins is unspecified'); - - // scan rules for react/ and fail if any exist - const reactRuleIds = Object.keys(config.rules) - .filter(ruleId => ruleId.indexOf('react/') === 0); - t.deepEquals(reactRuleIds, [], 'there are no react/ rules'); - }); -}); diff --git a/packages/eslint-config-nerdery/test/test-react-order.js b/packages/eslint-config-nerdery/test/test-react-order.js deleted file mode 100644 index f5b2d452fe..0000000000 --- a/packages/eslint-config-nerdery/test/test-react-order.js +++ /dev/null @@ -1,87 +0,0 @@ -import test from 'tape'; -import { CLIEngine } from 'eslint'; -import eslintrc from '../'; -import reactRules from '../rules/react'; - -const cli = new CLIEngine({ - useEslintrc: false, - baseConfig: eslintrc, - - // This rule fails when executing on text. - rules: { indent: 0 }, -}); - -function lint(text) { - // @see http://eslint.org/docs/developer-guide/nodejs-api.html#executeonfiles - // @see http://eslint.org/docs/developer-guide/nodejs-api.html#executeontext - const linter = cli.executeOnText(text); - return linter.results[0]; -} - -function wrapComponent(body) { - return ` -import React from 'react'; -export default class MyComponent extends React.Component { -${body} -} -`; -} - -test('validate react prop order', t => { - t.test('make sure our eslintrc has React linting dependencies', t => { - t.plan(1); - t.equal(reactRules.plugins[0], 'react', 'uses eslint-plugin-react'); - }); - - t.test('passes a good component', t => { - t.plan(3); - const result = lint(wrapComponent(` - componentWillMount() {} - componentDidMount() {} - setFoo() {} - getFoo() {} - setBar() {} - someMethod() {} - renderDogs() {} - render() { return
; } -`)); - - t.notOk(result.warningCount, 'no warnings'); - t.notOk(result.errorCount, 'no errors'); - t.deepEquals(result.messages, [], 'no messages in results'); - }); - - t.test('order: when random method is first', t => { - t.plan(2); - const result = lint(wrapComponent(` - someMethod() {} - componentWillMount() {} - componentDidMount() {} - setFoo() {} - getFoo() {} - setBar() {} - renderDogs() {} - render() { return
; } -`)); - - t.ok(result.errorCount, 'fails'); - t.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort'); - }); - - t.test('order: when random method after lifecycle methods', t => { - t.plan(2); - const result = lint(wrapComponent(` - componentWillMount() {} - componentDidMount() {} - someMethod() {} - setFoo() {} - getFoo() {} - setBar() {} - renderDogs() {} - render() { return
; } -`)); - - t.ok(result.errorCount, 'fails'); - t.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort'); - }); -}); From 7bb22b805d29636a9d32b3903d4b9e7b8e0658de Mon Sep 17 00:00:00 2001 From: Noah Blon Date: Tue, 6 Feb 2018 08:54:15 -0600 Subject: [PATCH 02/14] New link to linter page. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 98c928bcba..04712cac4e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ This document is not intended to: * Guide the reader in learning JavaScript [ESLint Config for the Nerdery JavaScript Standards](https://github.com/thenerdery/javascript-standards/linters) +[ESLint Config for the Nerdery JavaScript Standards](https://github.com/thenerdery/javascript-standards/tree/master/linters) ## Table of Contents From e3cb86e37971714ee3674eb29c4d7355251ada85 Mon Sep 17 00:00:00 2001 From: Noah Blon Date: Tue, 6 Feb 2018 08:55:46 -0600 Subject: [PATCH 03/14] Remove old link. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 04712cac4e..cca52db644 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ This document is not intended to: * Give advice on design patterns and project architecture * Guide the reader in learning JavaScript -[ESLint Config for the Nerdery JavaScript Standards](https://github.com/thenerdery/javascript-standards/linters) [ESLint Config for the Nerdery JavaScript Standards](https://github.com/thenerdery/javascript-standards/tree/master/linters) ## Table of Contents From 639b1e344d42cd30edf080cc64730c60129ac7d4 Mon Sep 17 00:00:00 2001 From: Martin Duran Date: Fri, 7 Sep 2018 14:10:55 -0500 Subject: [PATCH 04/14] Adds tslint config --- linters/tslint.json | 153 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 linters/tslint.json diff --git a/linters/tslint.json b/linters/tslint.json new file mode 100644 index 0000000000..2a77ee9fc0 --- /dev/null +++ b/linters/tslint.json @@ -0,0 +1,153 @@ +{ + "extends": ["tslint-eslint-rules"], + "rules": { + + // RECOMMENDATIONS + + "interface-name": [true, "always-prefix"], // Require interface names to begin with a capital ‘I’ + "deprecation": true, // Warn when deprecated APIs are used + + // MODULES + + "no-duplicate-imports": true, // Disallow duplicate imports + + // ARROW FUNCTIONS + + "prefer-arrow-callback": 2, // Require arrow functions as callbacks + "arrow-spacing": [2, { // Require space before/after arrows + "before": true, + "after": true + }], + + // VARIABLES + + "variable-name": [ // Check variable names for various errors + true, + "ban-keywords", + "check-format", + "allow-leading-underscore", + "allow-pascal-case" + ], + "one-variable-per-declaration": true, // Disallow multiple variable definitions in the same declaration statement + "no-duplicate-variable": [ // Disallow duplicate variable declarations in the same block scope, including parameters + true, + "check-parameters" + ], + "no-unused-expression": true, // Disallow unused expression statements + "no-shadowed-variable": true, // Disallow shadowing variable declarations + "no-unused-variable": true, // Disallow unused imports, variables, functions and private class members + "no-use-before-declare": true, // Disallow usage of variables before their declaration + "no-var-keyword": true, // Disallow usage of the var keyword + "prefer-const": true, // Require const when not reassigned + + // OBJECTS + + "object-literal-shorthand": true, // Enforce use of ES6 object literal shorthand + + // TYPES + + "typedef": [ // Require type definitions to exist + true, + "parameter", + "property-declaration" + ], + "typedef-whitespace": [ // Enforce one space after type information + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "no-any": true, // Disallow usage of any as a type declaration + "ban-types": [ // Disallow use of Object and String types + true, + ["Object"], + ["Boolean"], + ["String"] + ], + "no-extra-boolean-cast": true, // Prevent unnecessary boolean cast + "no-invalid-regexp": true, // Disallow invalid regular expression strings in the RegExp constructor + "no-construct": true, // Disallow String/Number/Boolean constructors + "radix": true, // Require the radix parameter to be specified when calling parseInt + "no-bitwise": true, // Disallow bitwise operators + + // STRINGS + + "no-eval": true, // Disallow eval function invocations + "quotemark": [true, "single", "jsx-double"], // Prefer single quotes for strings + + // BLOCKS + + "forin": true, // Require a for ... in statement to be filtered with an if statement + "curly": [true, "ignore-same-line"], // Enforce braces for if/for/do/while statements + + // COMPARISON + + "no-duplicate-switch-case": true, // Prevent duplicate cases in switch statements + "no-conditional-assignment": true, // Disallow assignment within conditionals + "cyclomatic-complexity": [true, 8], // Enforce a threshold of cyclomatic complexity + "no-switch-case-fall-through": true, // Disallow falling through case statements + "triple-equals": [true, "allow-null-check"], // Require === and !==, allow null check + + // WHITESPACE + + "whitespace": [ // Enforce whitespace style conventions + true, + "check-branch", + "check-decl", + "check-module", + "check-operator", + "check-separator", + "check-rest-spread", + "check-type", + "check-typecast", + "check-type-operator", + "check-preblock" + ], + "object-curly-spacing": [2, "always"], // Require spaces inside object curly braces + "indent": [true, "spaces", 4], // Enforce 4 spaces + "no-irregular-whitespace": true, // Disallow irregular whitespace + "no-trailing-whitespace": true, // Disallow trailing whitespace at the end of a line + "array-bracket-spacing": [2, "never"], // Disallow spaces inside of brackets + "eofline": true, // Require file to end with a newline + "max-line-length": [ // Disallow lines over 100 characters + true, + { + "limit": 100, + "ignore-pattern": "^import " + } + ], + + // SEMICOLONS + + "semicolon": [true, "always"], // Require semicolons + "no-extra-semi": true, // Disallow extra semicolons + + // COMMENTS + + "jsdoc-format": true, // Enforce basic format rules for JSDoc comments + "valid-jsdoc": [2, { // Require docblocks match params/return type + "requireParamDescription": false, + "requireReturnDescription": false, + "requireReturn": false + }], + "comment-format": [ // Require a space before comment + true, + "check-space" + ], + + // COMMAS + + "trailing-comma": [ // Require trailing commas + true, + { + "multiline": "always", + "singleline": "never" + } + ] + + } +} \ No newline at end of file From effc13019721108dfa28ca9903fc5d257f9de900 Mon Sep 17 00:00:00 2001 From: Martin Duran Date: Fri, 7 Sep 2018 19:12:17 -0500 Subject: [PATCH 05/14] Adds no-multi-spaces --- linters/tslint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/linters/tslint.json b/linters/tslint.json index 2a77ee9fc0..850c4e3a3b 100644 --- a/linters/tslint.json +++ b/linters/tslint.json @@ -94,6 +94,7 @@ // WHITESPACE + "no-multi-spaces": [true], // Disallow multiple spaces "whitespace": [ // Enforce whitespace style conventions true, "check-branch", From a7c2b6acf8cdb6164c9d80a2bf86b9ef8726119c Mon Sep 17 00:00:00 2001 From: Martin Duran Date: Thu, 13 Sep 2018 10:10:16 -0500 Subject: [PATCH 06/14] Changes interface-name rule to never-prefix --- linters/tslint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linters/tslint.json b/linters/tslint.json index 850c4e3a3b..88a1c9cd05 100644 --- a/linters/tslint.json +++ b/linters/tslint.json @@ -4,7 +4,7 @@ // RECOMMENDATIONS - "interface-name": [true, "always-prefix"], // Require interface names to begin with a capital ‘I’ + "interface-name": [true, "never-prefix"], // Require interface names to not have an “I” prefix "deprecation": true, // Warn when deprecated APIs are used // MODULES From efa3579004201a61358a1e29b21e042f221f6aca Mon Sep 17 00:00:00 2001 From: Martin Duran Date: Thu, 13 Sep 2018 15:26:57 -0500 Subject: [PATCH 07/14] Bans Function type --- linters/tslint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linters/tslint.json b/linters/tslint.json index 88a1c9cd05..0259c01a44 100644 --- a/linters/tslint.json +++ b/linters/tslint.json @@ -66,7 +66,8 @@ true, ["Object"], ["Boolean"], - ["String"] + ["String"], + ["Function"] ], "no-extra-boolean-cast": true, // Prevent unnecessary boolean cast "no-invalid-regexp": true, // Disallow invalid regular expression strings in the RegExp constructor From 044942d095df98909dbd9efb95eb686e5d49343a Mon Sep 17 00:00:00 2001 From: Martin Duran Date: Thu, 13 Sep 2018 15:56:53 -0500 Subject: [PATCH 08/14] Adds member-ordering rule --- linters/tslint.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linters/tslint.json b/linters/tslint.json index 0259c01a44..ef1e3c94bc 100644 --- a/linters/tslint.json +++ b/linters/tslint.json @@ -6,6 +6,12 @@ "interface-name": [true, "never-prefix"], // Require interface names to not have an “I” prefix "deprecation": true, // Warn when deprecated APIs are used + "member-ordering": [ // Enforce member ordering + true, + { + "order": "fields-first" + } + ], // MODULES From 014db3fab434890dc306af9c346ae7d0c26f5d0b Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Thu, 14 Apr 2022 13:27:40 -0400 Subject: [PATCH 09/14] Creates skeleton for eslint-config-nerdery-base package. --- packages/eslint-config-nerdery-base/.eslintrc.js | 4 ++++ packages/eslint-config-nerdery-base/package.json | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 packages/eslint-config-nerdery-base/.eslintrc.js create mode 100644 packages/eslint-config-nerdery-base/package.json diff --git a/packages/eslint-config-nerdery-base/.eslintrc.js b/packages/eslint-config-nerdery-base/.eslintrc.js new file mode 100644 index 0000000000..3e67d3ae7f --- /dev/null +++ b/packages/eslint-config-nerdery-base/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + rules: { + }, +}; diff --git a/packages/eslint-config-nerdery-base/package.json b/packages/eslint-config-nerdery-base/package.json new file mode 100644 index 0000000000..bc42f28cda --- /dev/null +++ b/packages/eslint-config-nerdery-base/package.json @@ -0,0 +1,8 @@ +{ + "name": "eslint-config-nerdery-base", + "version": "1.0.0", + "description": "Nerdery's base JS ESLint config", + "main": ".eslintrc.js", + "author": "Nerdery", + "license": "MIT" +} From d578631f9dcbba555bb28b518030e83180ab3df6 Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Fri, 15 Apr 2022 10:00:26 -0400 Subject: [PATCH 10/14] Adds a couple test rules. --- packages/eslint-config-nerdery-base/.eslintrc.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/eslint-config-nerdery-base/.eslintrc.js b/packages/eslint-config-nerdery-base/.eslintrc.js index 3e67d3ae7f..21636c4932 100644 --- a/packages/eslint-config-nerdery-base/.eslintrc.js +++ b/packages/eslint-config-nerdery-base/.eslintrc.js @@ -1,4 +1,6 @@ module.exports = { rules: { + 'import/prefer-default-export': 0, + 'no-plusplus': 0, }, }; From be799858b3fc53233572d6bcd6b509342d59a15c Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Tue, 19 Apr 2022 19:51:24 -0400 Subject: [PATCH 11/14] Adds rules to override airbnb's config and most of their configs. --- .../eslint-config-nerdery-base/.eslintrc.js | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-nerdery-base/.eslintrc.js b/packages/eslint-config-nerdery-base/.eslintrc.js index 21636c4932..1f6203377b 100644 --- a/packages/eslint-config-nerdery-base/.eslintrc.js +++ b/packages/eslint-config-nerdery-base/.eslintrc.js @@ -1,6 +1,46 @@ module.exports = { rules: { - 'import/prefer-default-export': 0, - 'no-plusplus': 0, + 'max-params': [2, 5], // Disallow more than 5 parameters + 'no-implicit-coercion': 2, // Disallow type conversion with shorter notations + 'class-methods-use-this': 0, // Allow class instance methods that don't use `this` to prevent unnecessary refactors + // 'import/order': {} // TODO + 'import/prefer-default-export': 0, // Allow single named exports to prevent unnecessary refactors + 'arrow-body-style': 0, // Disabled. Just because you *can* make something a one-liner, doesn't mean you should. + // 'prefer-destructuring': {} // TODO + 'no-continue': 0, // Allow continues. They can be used like an early return to increase readability. + 'no-plusplus': 0, // Allow ++ and --. The rationale for using this rule is that the operators are susceptible to automatic semicolon insertion issues, but that's an unlikely problem to run into. + 'object-curly-newline': 0, // Disabled to leave up to developer discretion + 'vars-on-top': 0, // Disabled because vars are disallowed so this check is superfluous. + 'arrow-parens': [2, 'as-needed'], // Require parens in arrow function arguments + 'camelcase': [2, { properties: 'always' }], // Require camelCase property names + 'newline-per-chained-call': [2, { // Require newline per chained method call + ignoreChainWithDepth: 2, + }], + 'spaced-comment': ['error', 'always', { // Require whitespace before comments + line: { + markers: ['/'], + exceptions: ['-'], + }, + block: { + markers: ['/', '*'], + }, + }], + curly: 2, // Require curly brace conventions + 'dot-notation': [2, { // Require dot notation + allowPattern: '^[a-z]+(_[a-z]+)+$', + }], + 'array-bracket-newline': 0, // Leave up to developer discretion + 'array-element-newline': 0, // Leave up to developer discretion + 'function-call-argument-newline': 0, // Leave up to developer discretion + 'max-depth': [1, 4], // Warn when blocks are nested too deeply + 'max-lines': [1, 500], // Warn when files become too long + 'import/no-default-export': 2, // Mixing default and named exports is unnecessary and can be confusing. This is a contentious topic though. Feel free to override this in your own config. + 'import/dynamic-import-chunkname': 2, // TODO: Test this + 'complexity': [1, 20], // Warn when code becomes too complex + 'no-implicit-coercion': 2, // Disallows shorthand type conversions + // 'no-invalid-this': {} // TODO + // 'no-unreachable-loop': {} // TODO + // 'no-restricted-exports': {} // TODO + // 'sort-imports': {} // TODO }, }; From 503280edea5f1e0d90259261d7b5cbf753aa3048 Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Thu, 28 Apr 2022 11:02:35 -0400 Subject: [PATCH 12/14] Fleshes out a hairy rule, removes some we changed our minds about overriding. --- packages/eslint-config-nerdery-base/.eslintrc.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config-nerdery-base/.eslintrc.js b/packages/eslint-config-nerdery-base/.eslintrc.js index 1f6203377b..8af9151918 100644 --- a/packages/eslint-config-nerdery-base/.eslintrc.js +++ b/packages/eslint-config-nerdery-base/.eslintrc.js @@ -6,7 +6,18 @@ module.exports = { // 'import/order': {} // TODO 'import/prefer-default-export': 0, // Allow single named exports to prevent unnecessary refactors 'arrow-body-style': 0, // Disabled. Just because you *can* make something a one-liner, doesn't mean you should. - // 'prefer-destructuring': {} // TODO + 'prefer-destructuring': ['error', { // Only prefer destructuring for `const { a } = obj;` (instead of `const a = obj.a`). Arrays and reassignments are left up to developer discretion. + VariableDeclarator: { + array: false, + object: true, + }, + AssignmentExpression: { + array: false, + object: false, + }, + }, { + enforceForRenamedProperties: false, + }], 'no-continue': 0, // Allow continues. They can be used like an early return to increase readability. 'no-plusplus': 0, // Allow ++ and --. The rationale for using this rule is that the operators are susceptible to automatic semicolon insertion issues, but that's an unlikely problem to run into. 'object-curly-newline': 0, // Disabled to leave up to developer discretion @@ -38,9 +49,6 @@ module.exports = { 'import/dynamic-import-chunkname': 2, // TODO: Test this 'complexity': [1, 20], // Warn when code becomes too complex 'no-implicit-coercion': 2, // Disallows shorthand type conversions - // 'no-invalid-this': {} // TODO - // 'no-unreachable-loop': {} // TODO - // 'no-restricted-exports': {} // TODO // 'sort-imports': {} // TODO }, }; From 821324f917d198e552ca73713a7c94da5a797ea8 Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Fri, 29 Apr 2022 13:58:23 -0400 Subject: [PATCH 13/14] Fleshes out import order rules --- packages/eslint-config-nerdery-base/.eslintrc.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config-nerdery-base/.eslintrc.js b/packages/eslint-config-nerdery-base/.eslintrc.js index 8af9151918..adae3511e6 100644 --- a/packages/eslint-config-nerdery-base/.eslintrc.js +++ b/packages/eslint-config-nerdery-base/.eslintrc.js @@ -3,7 +3,7 @@ module.exports = { 'max-params': [2, 5], // Disallow more than 5 parameters 'no-implicit-coercion': 2, // Disallow type conversion with shorter notations 'class-methods-use-this': 0, // Allow class instance methods that don't use `this` to prevent unnecessary refactors - // 'import/order': {} // TODO + 'import/order': ['error', { alphabetize: { order: 'asc' } }], 'import/prefer-default-export': 0, // Allow single named exports to prevent unnecessary refactors 'arrow-body-style': 0, // Disabled. Just because you *can* make something a one-liner, doesn't mean you should. 'prefer-destructuring': ['error', { // Only prefer destructuring for `const { a } = obj;` (instead of `const a = obj.a`). Arrays and reassignments are left up to developer discretion. @@ -21,7 +21,7 @@ module.exports = { 'no-continue': 0, // Allow continues. They can be used like an early return to increase readability. 'no-plusplus': 0, // Allow ++ and --. The rationale for using this rule is that the operators are susceptible to automatic semicolon insertion issues, but that's an unlikely problem to run into. 'object-curly-newline': 0, // Disabled to leave up to developer discretion - 'vars-on-top': 0, // Disabled because vars are disallowed so this check is superfluous. + 'vars-on-top': 0, // Disabled because vars are disallowed so this check is superfluous 'arrow-parens': [2, 'as-needed'], // Require parens in arrow function arguments 'camelcase': [2, { properties: 'always' }], // Require camelCase property names 'newline-per-chained-call': [2, { // Require newline per chained method call @@ -46,9 +46,12 @@ module.exports = { 'max-depth': [1, 4], // Warn when blocks are nested too deeply 'max-lines': [1, 500], // Warn when files become too long 'import/no-default-export': 2, // Mixing default and named exports is unnecessary and can be confusing. This is a contentious topic though. Feel free to override this in your own config. - 'import/dynamic-import-chunkname': 2, // TODO: Test this + 'import/dynamic-import-chunkname': 2, // If you're not using webpack or don't care about dynamically imported modules' filenames, feel free to disable this 'complexity': [1, 20], // Warn when code becomes too complex 'no-implicit-coercion': 2, // Disallows shorthand type conversions - // 'sort-imports': {} // TODO + 'sort-imports': ['error', { + ignoreDeclarationSort: true, // handled by import/order + ignoreMemberSort: false, + }], }, }; From 3994771e67d8d903f3eea63133d6d95ffde45ed6 Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Fri, 29 Apr 2022 14:07:57 -0400 Subject: [PATCH 14/14] Cleanup and organization --- packages/eslint-config-nerdery-base/.eslintrc.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config-nerdery-base/.eslintrc.js b/packages/eslint-config-nerdery-base/.eslintrc.js index adae3511e6..fa43cdb003 100644 --- a/packages/eslint-config-nerdery-base/.eslintrc.js +++ b/packages/eslint-config-nerdery-base/.eslintrc.js @@ -3,8 +3,6 @@ module.exports = { 'max-params': [2, 5], // Disallow more than 5 parameters 'no-implicit-coercion': 2, // Disallow type conversion with shorter notations 'class-methods-use-this': 0, // Allow class instance methods that don't use `this` to prevent unnecessary refactors - 'import/order': ['error', { alphabetize: { order: 'asc' } }], - 'import/prefer-default-export': 0, // Allow single named exports to prevent unnecessary refactors 'arrow-body-style': 0, // Disabled. Just because you *can* make something a one-liner, doesn't mean you should. 'prefer-destructuring': ['error', { // Only prefer destructuring for `const { a } = obj;` (instead of `const a = obj.a`). Arrays and reassignments are left up to developer discretion. VariableDeclarator: { @@ -45,10 +43,16 @@ module.exports = { 'function-call-argument-newline': 0, // Leave up to developer discretion 'max-depth': [1, 4], // Warn when blocks are nested too deeply 'max-lines': [1, 500], // Warn when files become too long + 'complexity': [1, 20], // Warn when code becomes too complex + 'no-implicit-coercion': 2, // Disallow shorthand type conversions + + 'import/prefer-default-export': 0, // Allow single named exports to prevent unnecessary refactors 'import/no-default-export': 2, // Mixing default and named exports is unnecessary and can be confusing. This is a contentious topic though. Feel free to override this in your own config. 'import/dynamic-import-chunkname': 2, // If you're not using webpack or don't care about dynamically imported modules' filenames, feel free to disable this - 'complexity': [1, 20], // Warn when code becomes too complex - 'no-implicit-coercion': 2, // Disallows shorthand type conversions + + // By default, we enforce sorting imports to simplify git history and make it easier when scanning for a specific import. + // It shouldn't cause too much trouble since it's auto-fixable, but if you find this to be more trouble than it's worth, feel free to disable these. + 'import/order': ['error', { alphabetize: { order: 'asc' } }], 'sort-imports': ['error', { ignoreDeclarationSort: true, // handled by import/order ignoreMemberSort: false,