From 338b5943f3675d928ba8894478e6f5f46e49a4d6 Mon Sep 17 00:00:00 2001 From: Hartorn Date: Thu, 19 Oct 2017 18:51:16 +0200 Subject: [PATCH 1/3] Disabling some rules, updating packages --- index.js | 22 +++++++++---------- package.json | 62 ++++++++++++++++++++++++++-------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/index.js b/index.js index efb8fe6..96ca5b1 100644 --- a/index.js +++ b/index.js @@ -110,7 +110,7 @@ module.exports = { // Warning when using litterals (should be wrapped in JSX, like {'toto'}) // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md 'react/jsx-no-literals': 'warn', - // Error when using component, without import or declaration + // Error when using component, without import or declaration // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md 'react/jsx-no-undef': 'error', // 'react/jsx-sort-prop-types': 'error', @@ -118,7 +118,7 @@ module.exports = { // Error when using JSX, when missing React variable // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md 'react/jsx-uses-react': 'error', - // Marking variable used in JSX as used + // Marking variable used in JSX as used // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md 'react/jsx-uses-vars': 'error', // Error when using component not in Pascal Case @@ -148,7 +148,7 @@ module.exports = { // Error when declaring mutiple component in one file // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md 'react/no-multi-comp': ['error', { 'ignoreStateless': true }], - // Error on unknown DOM property + // Error on unknown DOM property // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md 'react/no-unknown-property': 'error', // Warning on missing prop types @@ -173,8 +173,8 @@ module.exports = { 'require': { 'FunctionDeclaration': true, 'MethodDefinition': true, - 'ClassDeclaration': true, - 'ArrowFunctionExpression': true + 'ClassDeclaration': false, // Disabling because of decorators + 'ArrowFunctionExpression': false // Documenting lambda is too much } }], // Warning uncomplete comments @@ -190,7 +190,7 @@ module.exports = { // Error if not using simple quotes // http://eslint.org/docs/rules/quotes 'quotes': ['error', 'single', 'avoid-escape'], - // Error if not using === + // Error if not using === // http://eslint.org/docs/rules/eqeqeq 'eqeqeq': 'error', 'strict': 'error', @@ -266,13 +266,13 @@ module.exports = { // No multi line string (use backquote instead of \ in end of line) // http://eslint.org/docs/rules/no-multi-str 'no-multi-str': 'error', - // No primitive wrapper + // No primitive wrapper // http://eslint.org/docs/rules/no-new-wrappers 'no-new-wrappers': 'error', // No variable redeclare // http://eslint.org/docs/rules/no-redeclare 'no-redeclare': 'error', - // No return with an assign + // No return with an assign // http://eslint.org/docs/rules/no-return-assign 'no-return-assign': 'error', // No comparing a variable with itself @@ -287,7 +287,7 @@ module.exports = { // No TODO or fixme // http://eslint.org/docs/rules/no-warning-commentss 'no-warning-comments': ['warn', { 'terms': ['todo', 'fixme'], 'location': 'anywhere' }], - // Use radix in parseInt + // Use radix in parseInt // http://eslint.org/docs/rules/radix 'radix': 'error', // Wrap immediate function call in parenthesis @@ -311,10 +311,10 @@ module.exports = { // Error on extra semi colon // http://eslint.org/docs/rules/no-extra-semi 'no-extra-semi': 'error', - // No reassign on function + // No reassign on function // http://eslint.org/docs/rules/no-func-assign 'no-func-assign': 'error', - // No sparse arrays + // No sparse arrays // http://eslint.org/docs/rules/no-sparse-arrays 'no-sparse-arrays': 'error', // No unreachable code diff --git a/package.json b/package.json index 1cf3072..75a271f 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,33 @@ { - "name": "eslint-config-focus", - "version": "0.6.0", - "description": "Eslint shared configuration for all Focus projects", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/KleeGroup/eslint-config-focus.git" - }, - "keywords": [ - "eslint", - "eslint-config", - "focus", - "kleegroup" - ], - "author": "Stanislas Bernard", - "license": "MIT", - "bugs": { - "url": "https://github.com/KleeGroup/eslint-config-focus/issues" - }, - "homepage": "https://github.com/KleeGroup/eslint-config-focus#readme", - "dependencies": { - "babel-eslint": "7.2.3", - "eslint": "4.6.1", - "eslint-plugin-filenames": "1.2.0", - "eslint-plugin-import": "2.7.0", - "eslint-plugin-react": "7.3.0" - }, - "devDependencies": {} + "name": "eslint-config-focus", + "version": "0.6.0-beta1", + "description": "Eslint shared configuration for all Focus projects", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/KleeGroup/eslint-config-focus.git" + }, + "keywords": [ + "eslint", + "eslint-config", + "focus", + "kleegroup" + ], + "author": "Stanislas Bernard", + "license": "MIT", + "bugs": { + "url": "https://github.com/KleeGroup/eslint-config-focus/issues" + }, + "homepage": "https://github.com/KleeGroup/eslint-config-focus#readme", + "dependencies": { + "babel-eslint": "8.0.1", + "eslint": "4.9.0", + "eslint-plugin-filenames": "1.2.0", + "eslint-plugin-import": "2.8.0", + "eslint-plugin-react": "7.4.0" + }, + "devDependencies": {} } \ No newline at end of file From 05de0b8ab8e1c25fdddee5cf3f566e46c0995146 Mon Sep 17 00:00:00 2001 From: Hartorn Date: Thu, 19 Oct 2017 19:16:10 +0200 Subject: [PATCH 2/3] Minor changes about rules --- index.js | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/index.js b/index.js index 96ca5b1..36c4902 100644 --- a/index.js +++ b/index.js @@ -25,22 +25,11 @@ module.exports = { ], 'globals': { '__API_ROOT__': false, - '__LEGACY_SEARCH_API__': false, '__BASE_URL__': false, '__DEV__': false, '__ANCHOR_CLASS__': false, '__PACKAGE_JSON_PATH__': false, - '__USER__': false, - '__PROJECT__': false, - 'jQuery': false, - '$': true, - 'Focus': true, - 'FocusComponents': true, 'require': true, - 'Backbone': true, - 'React': true, - 'Fmk': true, - '_': true, 'Promise': true, 'module': true }, @@ -53,7 +42,7 @@ module.exports = { // analysis/correctness // Check if import can be resolved on file system // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md - 'import/no-unresolved': 'error', + 'import/no-unresolved': 'warning', // In case of alias, this should not be an error // Check if the import is correctly done, according to the named export, or the default one // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md 'import/named': 'error', @@ -135,7 +124,7 @@ module.exports = { 'react/no-did-mount-set-state': ['warn', 'disallow-in-func'], // Error when using setState in didUpdate // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md - 'react/no-did-update-set-state': ['error', 'disallow-in-func'], + 'react/no-did-update-set-state': ['warn', 'disallow-in-func'], // Error when trying to mutate the state directly // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md 'react/no-direct-mutation-state': 'error', @@ -147,7 +136,7 @@ module.exports = { 'react/prefer-stateless-function': ['warn', { 'ignorePureComponents': true }], // Error when declaring mutiple component in one file // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md - 'react/no-multi-comp': ['error', { 'ignoreStateless': true }], + 'react/no-multi-comp': ['warn', { 'ignoreStateless': true }], // Error on unknown DOM property // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md 'react/no-unknown-property': 'error', @@ -192,7 +181,7 @@ module.exports = { 'quotes': ['error', 'single', 'avoid-escape'], // Error if not using === // http://eslint.org/docs/rules/eqeqeq - 'eqeqeq': 'error', + eqeqeq: ['error', 'always', { null: 'ignore' }], 'strict': 'error', // Error if using not camelcase variables // http://eslint.org/docs/rules/camelcase @@ -202,7 +191,7 @@ module.exports = { 'no-underscore-dangle': 'off', // Constructor should begin with capital letter // http://eslint.org/docs/rules/new-cap - 'new-cap': 'error', + 'new-cap': 'warn', // Error if not using single quotes in JSX // http://eslint.org/docs/rules/jsx-quotes 'jsx-quotes': ['error', 'prefer-single'], @@ -229,13 +218,13 @@ module.exports = { 'key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }], // Maximum nested callbacks // http://eslint.org/docs/rules/max-nested-callbacks - 'max-nested-callbacks': ['error', 3], + 'max-nested-callbacks': ['warn', 3], // Avoid multiple empty lines (max 2) // http://eslint.org/docs/rules/no-multiple-empty-lines - 'no-multiple-empty-lines': 'error', + 'no-multiple-empty-lines': 'warn', // Quote props only if needed // http://eslint.org/docs/rules/quote-props - 'quote-props': ['error', 'as-needed'], + 'quote-props': ['warn', 'as-needed'], // Do not use variable before they are defined // http://eslint.org/docs/rules/no-use-before-define 'no-use-before-define': 'error', @@ -244,10 +233,10 @@ module.exports = { 'default-case': 'error', // Prefer foo.bar instead of foo["bar"] // http://eslint.org/docs/rules/dot-notation - 'dot-notation': 'error', + 'dot-notation': 'warn', // Alert should not be used // http://eslint.org/docs/rules/no-alert - 'no-alert': 'error', + 'no-alert': 'warn', // Allowing console logging // http://eslint.org/docs/rules/no-console 'no-console': 'off', @@ -333,6 +322,8 @@ module.exports = { // http://eslint.org/docs/rules/arrow-spacing 'arrow-spacing': 'error', // Ensure spacing around keywords - 'keyword-spacing': 'error' + 'keyword-spacing': 'error', + // Ensure that function parameter are not reassigned + 'no-param-reassign': ["error", { "props": true }] } }; From 40ef4c12c1a584a8e687a3e24d5ebd8051ea9fdf Mon Sep 17 00:00:00 2001 From: Hartorn Date: Mon, 26 Feb 2018 15:48:14 +0100 Subject: [PATCH 3/3] Version 0.6.1 - Updating dependencies, adding some rules --- .gitignore | 1 + index.js | 16 +++++++++++++--- package.json | 10 +++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 123ae94..74c5873 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ build/Release # Dependency directory # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git node_modules +/.history diff --git a/index.js b/index.js index 36c4902..9988d95 100644 --- a/index.js +++ b/index.js @@ -42,7 +42,7 @@ module.exports = { // analysis/correctness // Check if import can be resolved on file system // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md - 'import/no-unresolved': 'warning', // In case of alias, this should not be an error + 'import/no-unresolved': 'error', // In case of alias, this should be handled with eslint-import-resolver-webpack // Check if the import is correctly done, according to the named export, or the default one // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md 'import/named': 'error', @@ -231,7 +231,7 @@ module.exports = { // Switch must have default case, even if empty // http://eslint.org/docs/rules/default-case 'default-case': 'error', - // Prefer foo.bar instead of foo["bar"] + // Prefer foo.bar instead of foo['bar'] // http://eslint.org/docs/rules/dot-notation 'dot-notation': 'warn', // Alert should not be used @@ -324,6 +324,16 @@ module.exports = { // Ensure spacing around keywords 'keyword-spacing': 'error', // Ensure that function parameter are not reassigned - 'no-param-reassign': ["error", { "props": true }] + 'no-param-reassign': ['error', { 'props': true }], + // Ensure proper use of Array function https://eslint.org/docs/rules/array-callback-return + 'array-callback-return': 'error', + // Ensure consistent behaviour for function https://eslint.org/docs/rules/consistent-return + 'consistent-return': 'error', + // Ensure there is no call to arguments.caller https://eslint.org/docs/rules/no-caller + 'no-caller': 'error', + // Ensure there is no empty function without comments https://eslint.org/docs/rules/no-empty-function + 'no-empty-function': 'error', + // Ensure the usage of curly braces for multi-line blocks + curly: ['error', 'multi-line'] } }; diff --git a/package.json b/package.json index 75a271f..efcead7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-focus", - "version": "0.6.0-beta1", + "version": "0.6.1", "description": "Eslint shared configuration for all Focus projects", "main": "index.js", "scripts": { @@ -23,11 +23,11 @@ }, "homepage": "https://github.com/KleeGroup/eslint-config-focus#readme", "dependencies": { - "babel-eslint": "8.0.1", - "eslint": "4.9.0", + "babel-eslint": "8.2.2", + "eslint": "4.18.1", "eslint-plugin-filenames": "1.2.0", - "eslint-plugin-import": "2.8.0", - "eslint-plugin-react": "7.4.0" + "eslint-plugin-import": "2.9.0", + "eslint-plugin-react": "7.7.0" }, "devDependencies": {} } \ No newline at end of file