Skip to content

Commit

Permalink
Merge pull request #9 from KleeGroup/fix-rules
Browse files Browse the repository at this point in the history
Fix rules
  • Loading branch information
c3dr0x authored Feb 26, 2018
2 parents 7104cf2 + 40ef4c1 commit c291221
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 65 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
69 changes: 35 additions & 34 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -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': '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',
Expand Down Expand Up @@ -110,15 +99,15 @@ 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',
// 'react/jsx-sort-props': 'error',
// 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
Expand All @@ -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',
Expand All @@ -147,8 +136,8 @@ 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 }],
// Error on unknown DOM property
'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',
// Warning on missing prop types
Expand All @@ -173,8 +162,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
Expand All @@ -190,9 +179,9 @@ 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',
eqeqeq: ['error', 'always', { null: 'ignore' }],
'strict': 'error',
// Error if using not camelcase variables
// http://eslint.org/docs/rules/camelcase
Expand All @@ -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'],
Expand All @@ -229,25 +218,25 @@ 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',
// 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': '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',
Expand All @@ -266,13 +255,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
Expand All @@ -287,7 +276,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
Expand All @@ -311,10 +300,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
Expand All @@ -333,6 +322,18 @@ 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 }],
// 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']
}
};
62 changes: 31 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -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.1",
"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.2.2",
"eslint": "4.18.1",
"eslint-plugin-filenames": "1.2.0",
"eslint-plugin-import": "2.9.0",
"eslint-plugin-react": "7.7.0"
},
"devDependencies": {}
}

0 comments on commit c291221

Please sign in to comment.