diff --git a/configurations/es5-browser.js b/configurations/es5-browser.js index a77229d..2f7fac8 100644 --- a/configurations/es5-browser.js +++ b/configurations/es5-browser.js @@ -1,14 +1,14 @@ module.exports = { extends: [ - './es5.js' + './es5.js', ].map(require.resolve), env: { browser: true, node: false, amd: false, mocha: false, - jasmine: false - } + jasmine: false, + }, }; diff --git a/configurations/es5-node.js b/configurations/es5-node.js index 96181c1..30adc76 100644 --- a/configurations/es5-node.js +++ b/configurations/es5-node.js @@ -2,13 +2,13 @@ module.exports = { extends: [ './es5.js', - '../rules/node.js' + '../rules/node.js', ].map(require.resolve), env: { browser: false, node: true, amd: false, mocha: false, - jasmine: false - } + jasmine: false, + }, }; diff --git a/configurations/es5.js b/configurations/es5.js index 0b68326..10d5686 100644 --- a/configurations/es5.js +++ b/configurations/es5.js @@ -6,12 +6,12 @@ module.exports = { '../rules/best-practices', '../rules/errors', '../rules/style', - '../rules/variables' + '../rules/variables', ].map(require.resolve), env: {}, parserOptions: { ecmaVersion: 5, - sourceType: 'module' - } + sourceType: 'module', + }, }; diff --git a/configurations/es6-browser.js b/configurations/es6-browser.js index b42ed23..1a304ed 100644 --- a/configurations/es6-browser.js +++ b/configurations/es6-browser.js @@ -1,14 +1,14 @@ module.exports = { extends: [ - './es6.js' + './es6.js', ].map(require.resolve), env: { browser: true, node: false, amd: false, mocha: false, - jasmine: false - } + jasmine: false, + }, }; diff --git a/configurations/es6-node.js b/configurations/es6-node.js index 5037c96..e0cce7b 100644 --- a/configurations/es6-node.js +++ b/configurations/es6-node.js @@ -2,13 +2,14 @@ module.exports = { extends: [ './es6.js', - '../rules/node.js' + '../rules/node.js', ].map(require.resolve), env: { browser: false, node: true, amd: false, mocha: false, - jasmine: false - } + jasmine: false, + }, + }; diff --git a/configurations/es6-react.js b/configurations/es6-react.js index c0d9795..a1426ab 100644 --- a/configurations/es6-react.js +++ b/configurations/es6-react.js @@ -1,42 +1,42 @@ module.exports = { - plugins: [ + 'plugins': [ 'jsx-a11y', - 'react' + 'react', ], - extends: [ + 'extends': [ './es6.js', '../rules/react', - '../rules/react-a11y' + '../rules/react-a11y', ].map(require.resolve), - env: { - browser: true, - node: false, - amd: false, - mocha: false, - jasmine: false + 'env': { + 'browser': true, + 'node': false, + 'amd': false, + 'mocha': false, + 'jasmine': false, }, - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: { - generators: false, - objectLiteralDuplicateProperties: false, - jsx: true - } + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module', + 'ecmaFeatures': { + 'generators': false, + 'objectLiteralDuplicateProperties': false, + 'jsx': true, + }, }, - ecmaFeatures: { - jsx: true + 'ecmaFeatures': { + 'jsx': true, }, - settings: { + 'settings': { 'import/resolver': { - node: { - extensions: ['.js', '.jsx', '.json'] - } + 'node': { + 'extensions': ['.js', '.jsx', '.json'], + }, + }, + 'react': { + 'pragma': 'React', + 'version': '0.15', }, - react: { - pragma: 'React', - version: '0.15' - } - } + }, }; diff --git a/configurations/es6.js b/configurations/es6.js index c9f2af2..5f95f32 100644 --- a/configurations/es6.js +++ b/configurations/es6.js @@ -1,18 +1,18 @@ module.exports = { env: { - es6: true + es6: true, }, plugins: [ - 'import' + 'import', ], settings: { 'import/resolver': { node: { - extensions: ['.js', '.json'] - } - } + extensions: ['.js', '.json'], + }, + }, }, extends: [ '../rules/node-disable', @@ -21,7 +21,7 @@ module.exports = { '../rules/style', '../rules/variables', '../rules/imports', - '../rules/es6' + '../rules/es6', ].map(require.resolve), parserOptions: { @@ -29,8 +29,8 @@ module.exports = { sourceType: 'module', ecmaFeatures: { generators: false, - objectLiteralDuplicateProperties: false - } - } + objectLiteralDuplicateProperties: false, + }, + }, }; diff --git a/package.json b/package.json index 46978af..deb1024 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@namics/eslint-config", - "version": "1.0.0", + "version": "2.0.0", "description": "Default configurations for eslint", "author": "Simon Mollweide ", "license": "MIT", diff --git a/processing/.eslintrc.js b/processing/.eslintrc.js new file mode 100644 index 0000000..ae28003 --- /dev/null +++ b/processing/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../configurations/es5-node.js" +}; diff --git a/processing/utils.js b/processing/utils.js index 60fcc55..6aca14a 100755 --- a/processing/utils.js +++ b/processing/utils.js @@ -1,4 +1,5 @@ 'use strict'; +/* eslint "no-console": 0 */ var fs = require('fs'); @@ -7,8 +8,8 @@ module.exports = { /** * * @method getStats - * @param {string} dirFileName - * @returns {object} getStats + * @param {string} dirFileName - the directory name + * @returns {Object} getStats * @public */ getStats: function (dirFileName) { @@ -18,8 +19,8 @@ module.exports = { /** * * @method isDir - * @param {string} dirName - * @returns {boolean} isDir + * @param {string} dirName - the directory name + * @returns {boolean} isDir - is directory * @public */ existDir: function (dirName) { @@ -28,7 +29,9 @@ module.exports = { try { isDir = this.getStats(dirName).isDirectory(); - } catch (err) {} + } catch (err) { + isDir = false; + } return isDir; }, @@ -36,8 +39,8 @@ module.exports = { /** * * @method existFile - * @param {string} path - * @returns {boolean} isFile + * @param {string} path - the path + * @returns {boolean} isFile - is given path a file or not * @public */ existFile: function (path) { @@ -46,7 +49,9 @@ module.exports = { try { isFile = this.getStats(path).isFile(); - } catch (err) {} + } catch (err) { + isFile = false; + } return isFile; }, @@ -54,8 +59,9 @@ module.exports = { /** * * @method writeFile - * @param {string} path - * @param {object} data + * @param {string} path - the path + * @param {Object} data - the data object + * @returns {void} * @public */ writeFile: function (path, data) { @@ -65,8 +71,8 @@ module.exports = { /** * * @method readFile - * @param {string} path - * @returns {string} + * @param {string} path - the path + * @returns {string} returns the file data * @public */ readFile: function (path) { @@ -76,13 +82,14 @@ module.exports = { /** * * @method writeFile - * @param {string} dir - * @param {Array|undefined} ignoreFiles + * @param {string} dir - the directory path + * @param {Array|undefined} ignoreFiles - the files which should be ignored + * @returns {Array} the result set * @public */ readDir: function (dir, ignoreFiles) { - var results = [], - list = []; + var results = []; + var list = []; ignoreFiles = ignoreFiles || []; @@ -92,11 +99,11 @@ module.exports = { console.error('Folder "' + err.path + '" not found!'); } - list.forEach(function(file) { + list.forEach(function (file) { if (ignoreFiles.indexOf(file) < 0) { results.push({ path: dir + '/' + file, - file: file + file: file, }); } }); @@ -107,14 +114,12 @@ module.exports = { * Capitalizes the first letter of the given string. * * @method capitalize - * @param {String} str - * The original string - * @return {String} - * The capitalized string + * @param {string} str - The original string + * @returns {string} The capitalized string */ - capitalize: function(str) { + capitalize: function (str) { // Capitalize the first letter return str.substr(0, 1).toUpperCase().concat(str.substr(1)); - } + }, -}; \ No newline at end of file +}; diff --git a/processing/write-documentation.js b/processing/write-documentation.js index 1459f90..acdf748 100644 --- a/processing/write-documentation.js +++ b/processing/write-documentation.js @@ -1,14 +1,15 @@ +/* eslint "complexity": 0 */ -var utils = require('./utils'), - ig = ['.DS_Store', '.eslintrc'], - fileName, - data; +var utils = require('./utils'); +var ig = ['.DS_Store', '.eslintrc']; +var fileName; +var data; /** * @method getESLintUrl - * @param {String} name fileName - * @param {String} groupName name of group - * @returns {String} eslint documentation url + * @param {string} name - fileName + * @param {string} groupName - name of group + * @returns {string} eslint documentation url */ function getESLintUrl(name, groupName) { @@ -27,11 +28,11 @@ function getESLintUrl(name, groupName) { /** * @method getStatusIcon - * @param {String} fileData string read from file - * @returns {String} statusIcon (unicode character) + * @param {string} fileData - string read from file + * @returns {string} statusIcon (unicode character) */ function getStatusIcon(fileData) { - var exp = /STATUS = (.*)/.exec(fileData); + var exp = (/STATUS = (.*)/).exec(fileData); if (exp === null || exp.length < 1) { return ''; @@ -47,11 +48,11 @@ function getStatusIcon(fileData) { /** * @method getStatus - * @param {String} fileData string read from file - * @returns {String} status + * @param {string} fileData - string read from file + * @returns {string} status */ function getStatus(fileData) { - var exp = /STATUS = (.*)/.exec(fileData); + var exp = (/STATUS = (.*)/).exec(fileData); if (exp === null || exp.length < 1) { return ''; @@ -67,11 +68,11 @@ function getStatus(fileData) { /** * @method getDescription - * @param {String} fileData string read from file - * @returns {String} description + * @param {string} fileData string read from file + * @returns {string} description */ function getDescription(fileData) { - var exp = /DESCRIPTION = (.*)/.exec(fileData); + var exp = (/DESCRIPTION = (.*)/).exec(fileData); if (exp === null || exp.length < 1) { return ''; @@ -82,8 +83,8 @@ function getDescription(fileData) { /** * @method getTitle - * @param {String} name fileName - * @returns {String} title from fileName + * @param {string} name fileName + * @returns {string} title from fileName */ function getTitle(name) { return utils.capitalize(name.replace('-', ' ')); @@ -92,12 +93,12 @@ function getTitle(name) { /** * @method addSnippet * @param {Array} arr output readme lines array - * @param {String} fileData string read from file + * @param {string} fileData string read from file * @returns {void} */ function addSnippet(arr, fileData) { - var exp = /)/.exec(fileData), - code; + var exp = (/)/).exec(fileData); + var code; if (exp === null || exp.length < 1) { return; @@ -117,16 +118,16 @@ function addSnippet(arr, fileData) { /** * @method getESLintUrl * @param {Array} arr output readme lines array - * @param {String} name fileName - * @param {String} path filepath - * @param {String} groupName name of group + * @param {string} name fileName + * @param {string} path filepath + * @param {string} groupName name of group * @returns {void} */ function addRule(arr, name, path, groupName) { - var fileData = utils.readFile(path), - nameCleaned = name.replace(/\.js$/, ''), - title = utils.capitalize(nameCleaned.replace(/-/g, ' ')); + var fileData = utils.readFile(path); + var nameCleaned = name.replace(/\.js$/, ''); + var title = utils.capitalize(nameCleaned.replace(/-/g, ' ')); arr.push('### [' + title + '](' + getESLintUrl(nameCleaned, groupName) + ')'); arr.push(''); @@ -144,7 +145,7 @@ function addRule(arr, name, path, groupName) { /** * @method writeDocumentationFile - * @param {String} name fileName + * @param {string} name fileName * @param {Array} dataArr array with lines of readme * @returns {void} */ diff --git a/processing/write-rule-test-files.js b/processing/write-rule-test-files.js index c5fa6bb..7de0066 100644 --- a/processing/write-rule-test-files.js +++ b/processing/write-rule-test-files.js @@ -1,56 +1,67 @@ +/* eslint "no-console": 0 */ -var utils = require('./utils'), - argv = process.argv, - filePath, - destPath, - data; +var utils = require('./utils'); +var argv = process.argv; +var filePath; +var destPath; +var data; -if (argv.length < 4) { - return; -} +/** + * @method writeTestFiles + * @returns {void} + */ +function writeTestFiles() { -filePath = argv[2]; -destPath = argv[3]; -data = utils.readFile(filePath); + if (argv.length < 4) { + return; + } -data.split('\n\n').map(function (rule) { + filePath = argv[2]; + destPath = argv[3]; + data = utils.readFile(filePath); - var ruleSpl = rule.split('\n'), - desc, - destFileName, - nameStatus, - nameStatusSpl, - data = ['']; + data.split('\n\n').map(function (rule) { - if (ruleSpl.length < 1) { - return; - } + var ruleSpl = rule.split('\n'); + var desc; + var destFileName; + var nameStatus; + var nameStatusSpl; + var fileData = ['']; - desc = ruleSpl[0].replace('//', '').trim(); - nameStatus = ruleSpl[1] - .replace('//', '') - .trim() - .replace(/\[([^, {]*).*/g, '$1') - .replace(/'/g, ''); + if (ruleSpl.length < 1) { + return true; + } - nameStatusSpl = nameStatus.split(':'); + desc = ruleSpl[0].replace('//', '').trim(); + nameStatus = ruleSpl[1] + .replace('//', '') + .trim() + .replace(/\[([^, {]*).*/g, '$1') + .replace(/'/g, ''); - destFileName = destPath + nameStatusSpl[0].replace(/^.*\//, '') + '.js'; + nameStatusSpl = nameStatus.split(':'); - if (utils.existFile(destFileName)) { - return; - } + destFileName = destPath + nameStatusSpl[0].replace(/^.*\//, '') + '.js'; + + if (utils.existFile(destFileName)) { + return true; + } - data.push('// DESCRIPTION = ' + desc); - data.push('// STATUS = ' + parseInt((nameStatusSpl[1] || 0), 10)); - data.push(''); - data.push('// '); - data.push('document.window.append(\'\', null);'); - data.push(''); + fileData.push('// DESCRIPTION = ' + desc); + fileData.push('// STATUS = ' + parseInt((nameStatusSpl[1] || 0), 10)); + fileData.push(''); + fileData.push('// '); + fileData.push('document.window.append(\'\', null);'); + fileData.push(''); - utils.writeFile(destFileName, data.join('\n')); - console.info('File written: ' + destFileName); + utils.writeFile(destFileName, fileData.join('\n')); + console.info('File written: ' + destFileName); + + return true; + }); +} -}); \ No newline at end of file +writeTestFiles(); diff --git a/rules/best-practices.js b/rules/best-practices.js index 5c02ea6..d138824 100644 --- a/rules/best-practices.js +++ b/rules/best-practices.js @@ -60,8 +60,8 @@ module.exports = { allow: [ 'arrowFunctions', 'functions', - 'methods' - ] + 'methods', + ], }], // disallow empty destructuring patterns @@ -122,7 +122,7 @@ module.exports = { ignore: [], ignoreArrayIndexes: true, enforceConst: true, - detectObjects: false + detectObjects: false, }], // disallow use of multiple spaces @@ -210,7 +210,7 @@ module.exports = { // disallow usage of configurable warning terms in comments: e.g. 'no-warning-comments': [0, - { terms: ['todo', 'fixme'], location: 'start' } + { terms: ['todo', 'fixme'], location: 'start' }, ], // disallow use of the with statement @@ -228,6 +228,6 @@ module.exports = { 'wrap-iife': [2, 'outside'], // require or disallow Yoda conditions - 'yoda': 2 - } + 'yoda': 2, + }, }; diff --git a/rules/errors.js b/rules/errors.js index 24862b8..ddc014c 100644 --- a/rules/errors.js +++ b/rules/errors.js @@ -3,8 +3,9 @@ module.exports = { rules: { // require trailing commas in multiline object literals - 'comma-dangle': [2, 'never'], + 'comma-dangle': [2, 'always-multiline'], // [13.07.2016] enabled + // [20.09.2016] always-multiline -> https://github.com/namics/eslint-config-namics/issues/1 // disallow assignment in conditional expressions 'no-cond-assign': [2, 'always'], @@ -47,7 +48,7 @@ module.exports = { 'no-extra-parens': [0, 'all', { conditionalAssign: true, nestedBinaryExpressions: false, - returnAssign: false + returnAssign: false, }], // disallow unnecessary semicolons @@ -103,7 +104,7 @@ module.exports = { params: 'param', class: 'constructor', return: 'returns', - virtual: 'abstract' + virtual: 'abstract', }, preferType: { Boolean: 'boolean', @@ -111,13 +112,13 @@ module.exports = { object: 'Object', String: 'string', array: 'Array', - xml: 'XML' + xml: 'XML', }, requireReturnDescription: true, - requireParamDescription: true + requireParamDescription: true, }], // ensure that the results of typeof are compared against a valid string - 'valid-typeof': 2 - } + 'valid-typeof': 2, + }, }; diff --git a/rules/es6-disable.js b/rules/es6-disable.js index 54c34ff..23b2ed4 100644 --- a/rules/es6-disable.js +++ b/rules/es6-disable.js @@ -100,6 +100,6 @@ module.exports = { // enforce spacing around the * in yield* expressions // http://eslint.org/docs/rules/yield-star-spacing - 'yield-star-spacing': 0 - } + 'yield-star-spacing': 0, + }, }; diff --git a/rules/es6.js b/rules/es6.js index e3c263d..fda721a 100644 --- a/rules/es6.js +++ b/rules/es6.js @@ -29,7 +29,7 @@ module.exports = { // disallow arrow functions where they could be confused with comparisons // http://eslint.org/docs/rules/no-confusing-arrow 'no-confusing-arrow': [2, { - allowParens: true + allowParens: true, }], // disallow modifying variables that are declared using const @@ -67,7 +67,7 @@ module.exports = { 'no-useless-rename': [2, { ignoreDestructuring: false, ignoreImport: false, - ignoreExport: false + ignoreExport: false, }], // require let or const instead of var @@ -77,19 +77,19 @@ module.exports = { // http://eslint.org/docs/rules/object-shorthand 'object-shorthand': [2, 'always', { ignoreConstructors: false, - avoidQuotes: true + avoidQuotes: true, }], // suggest using arrow functions as callbacks 'prefer-arrow-callback': [2, { allowNamedFunctions: false, - allowUnboundThis: true + allowUnboundThis: true, }], // suggest using of const declaration for variables that are never modified after declared 'prefer-const': [2, { destructuring: 'any', - ignoreReadBeforeAssign: true + ignoreReadBeforeAssign: true, }], // suggest using Reflect methods where applicable @@ -120,6 +120,6 @@ module.exports = { // enforce spacing around the * in yield* expressions // http://eslint.org/docs/rules/yield-star-spacing - 'yield-star-spacing': [2, 'after'] - } + 'yield-star-spacing': [2, 'after'], + }, }; diff --git a/rules/imports.js b/rules/imports.js index ee07721..565e1fc 100644 --- a/rules/imports.js +++ b/rules/imports.js @@ -2,22 +2,22 @@ /* [21.07.2016] approved by skill group core team */ module.exports = { env: { - es6: true + es6: true, }, parserOptions: { ecmaVersion: 6, - sourceType: 'module' + sourceType: 'module', }, plugins: [ - 'import' + 'import', ], settings: { 'import/resolver': { node: { - extensions: ['.js', '.json'] - } - } + extensions: ['.js', '.json'], + }, + }, }, rules: { @@ -60,7 +60,7 @@ module.exports = { // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md 'import/no-extraneous-dependencies': [0, { devDependencies: false, - optionalDependencies: false + optionalDependencies: false, }], // Forbid mutable exports @@ -103,7 +103,7 @@ module.exports = { // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md 'import/order': [0, { 'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], - 'newlines-between': 'never' + 'newlines-between': 'never', }], // Require a newline after the last import/require in a group @@ -112,6 +112,6 @@ module.exports = { // Require modules with a single export to use a default export // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md - 'import/prefer-default-export': 0 - } + 'import/prefer-default-export': 0, + }, }; diff --git a/rules/node-disable.js b/rules/node-disable.js index c91586a..19fb5d5 100644 --- a/rules/node-disable.js +++ b/rules/node-disable.js @@ -29,6 +29,6 @@ module.exports = { 'no-restricted-modules': 0, // disallow use of synchronous methods (off by default) - 'no-sync': 0 - } + 'no-sync': 0, + }, }; diff --git a/rules/node.js b/rules/node.js index a0618cf..727004a 100644 --- a/rules/node.js +++ b/rules/node.js @@ -31,6 +31,6 @@ module.exports = { 'no-restricted-modules': 0, // disallow use of synchronous methods (off by default) - 'no-sync': 0 - } + 'no-sync': 0, + }, }; diff --git a/rules/react-a11y.js b/rules/react-a11y.js index 68e876c..ca227ef 100644 --- a/rules/react-a11y.js +++ b/rules/react-a11y.js @@ -66,6 +66,6 @@ module.exports = { // Enforce tabIndex value is not greater than zero. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md - 'jsx-a11y/tabindex-no-positive': 0 - } + 'jsx-a11y/tabindex-no-positive': 0, + }, }; diff --git a/rules/react.js b/rules/react.js index 0583c4e..1889596 100644 --- a/rules/react.js +++ b/rules/react.js @@ -32,7 +32,7 @@ module.exports = { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md 'react/jsx-handler-names': [2, { eventHandlerPrefix: 'handle', - eventHandlerPropPrefix: 'on' + eventHandlerPropPrefix: 'on', }], // [21.07.2016] enabled @@ -56,7 +56,7 @@ module.exports = { 'react/jsx-no-bind': [2, { ignoreRefs: true, allowArrowFunctions: true, - allowBind: false + allowBind: false, }], // Prevent duplicate props in JSX @@ -75,7 +75,7 @@ module.exports = { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md 'react/jsx-pascal-case': [2, { allowAllCaps: true, - ignore: [] + ignore: [], }], // Enforce propTypes declarations alphabetical sorting @@ -83,7 +83,7 @@ module.exports = { 'react/sort-prop-types': [2, { ignoreCase: true, callbacksLast: true, - requiredFirst: true + requiredFirst: true, }], // deprecated in favor of react/jsx-sort-props @@ -94,7 +94,7 @@ module.exports = { 'react/jsx-sort-props': [2, { ignoreCase: true, callbacksLast: true, - shorthandFirst: true + shorthandFirst: true, }], // Prevent React to be incorrectly marked as unused @@ -188,8 +188,8 @@ module.exports = { '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', 'everything-else', '/^render.+$/', - 'render' - ] + 'render', + ], }], // Prevent missing parentheses around multilines JSX @@ -197,7 +197,7 @@ module.exports = { 'react/jsx-wrap-multilines': [2, { declaration: true, assignment: true, - return: true + return: true, }], // Require that the first prop in a JSX element be on a new line when the element is multiline @@ -215,6 +215,6 @@ module.exports = { // disallow target="_blank" on links // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md - 'react/jsx-no-target-blank': 0 - } + 'react/jsx-no-target-blank': 0, + }, }; diff --git a/rules/strict.js b/rules/strict.js index 6cfbf3f..d772e0c 100644 --- a/rules/strict.js +++ b/rules/strict.js @@ -1,6 +1,6 @@ module.exports = { rules: { // babel inserts `'use strict';` for us - strict: [2, 'never'] - } + strict: [2, 'never'], + }, }; diff --git a/rules/style.js b/rules/style.js index 081d8ab..6f375de 100644 --- a/rules/style.js +++ b/rules/style.js @@ -39,8 +39,9 @@ module.exports = { // Blacklist certain identifiers to prevent them being used // http://eslint.org/docs/rules/id-blacklist - 'id-blacklist': [2, 'data', 'callback'], + 'id-blacklist': [2, 'callback'], // [08.07.2016] enabled + // [20.09.2016] removed data because needed in jquery ajax options // this option enforces minimum and maximum identifier lengths // (variable names, property names etc.) @@ -68,8 +69,8 @@ module.exports = { overrides: { return: { after: true }, throw: { after: true }, - case: { after: true } - } + case: { after: true }, + }, }], // disallow mixed 'LF' and 'CRLF' as linebreaks @@ -86,7 +87,7 @@ module.exports = { // http://eslint.org/docs/rules/max-len 'max-len': [2, 120, 2, { ignoreUrls: true, - ignoreComments: false + ignoreComments: false, }], // [08.07.2016] enabled @@ -167,7 +168,7 @@ module.exports = { 'DebuggerStatement', 'ForInStatement', 'LabeledStatement', - 'WithStatement' + 'WithStatement', ], // disallow space between function identifier and application @@ -197,14 +198,14 @@ module.exports = { // enforce 'same line' or 'multiple line' on object properties. // http://eslint.org/docs/rules/object-property-newline 'object-property-newline': [0, { - allowMultiplePropertiesPerLine: true + allowMultiplePropertiesPerLine: true, }], // allow just one var statement per function 'one-var': [2, { 'var': 'never', 'let': 'never', - 'const': 'never' + 'const': 'never', }], // [08.07.2016] enabled never @@ -236,8 +237,8 @@ module.exports = { require: { FunctionDeclaration: true, MethodDefinition: true, - ClassDeclaration: true - } + ClassDeclaration: true, + }, }], // [08.07.2016] enabled @@ -270,7 +271,7 @@ module.exports = { 'spaced-comment': [2, 'always', { exceptions: ['-', '+'], // space here to support sprockets directives - markers: ['=', '!'] + markers: ['=', '!'], }], // require or disallow the Unicode Byte Order Mark @@ -278,7 +279,7 @@ module.exports = { 'unicode-bom': [2, 'never'], // require regex literals to be wrapped in parentheses - 'wrap-regex': 2 + 'wrap-regex': 2, // [11.07.2016] enabled - } + }, }; diff --git a/rules/variables.js b/rules/variables.js index 35f92dd..ca5eed5 100644 --- a/rules/variables.js +++ b/rules/variables.js @@ -36,6 +36,6 @@ module.exports = { 'no-unused-vars': [2, { vars: 'local', args: 'after-used' }], // disallow use of variables before they are defined - 'no-use-before-define': 2 - } + 'no-use-before-define': 2, + }, }; diff --git a/test/es5/rules/best-practices/accessor-pairs.js b/test/es5/rules/best-practices/accessor-pairs.js index 32f0eb5..c04aae3 100644 --- a/test/es5/rules/best-practices/accessor-pairs.js +++ b/test/es5/rules/best-practices/accessor-pairs.js @@ -9,7 +9,7 @@ var example; example = { set a(value) { this.val = value; - } + }, }; @@ -20,7 +20,7 @@ example = { }, get a() { return this.val; - } + }, }; // END!> diff --git a/test/es5/rules/best-practices/block-scoped-var.js b/test/es5/rules/best-practices/block-scoped-var.js index 70aa838..443dffa 100644 --- a/test/es5/rules/best-practices/block-scoped-var.js +++ b/test/es5/rules/best-practices/block-scoped-var.js @@ -29,7 +29,7 @@ example = { } document.window.append(build.toString(), null); - } + }, }; // END!> diff --git a/test/es5/rules/errors/comma-dangle.js b/test/es5/rules/errors/comma-dangle.js index a2aabbb..e4b31fa 100644 --- a/test/es5/rules/errors/comma-dangle.js +++ b/test/es5/rules/errors/comma-dangle.js @@ -16,14 +16,14 @@ /* var bad = { bar: 'baz', - qux: 'quux', + qux: 'quux' }; */ // Good var good = { bar: 'baz', - qux: 'quux' + qux: 'quux', }; // END!> document.window.append('', null); diff --git a/test/es5/rules/style/space-before-function-paren.js b/test/es5/rules/style/space-before-function-paren.js index 086a3ea..ba3bbc0 100644 --- a/test/es5/rules/style/space-before-function-paren.js +++ b/test/es5/rules/style/space-before-function-paren.js @@ -47,6 +47,6 @@ class Foo { var foo = { bar() { // ... - } + }, }; // END!> diff --git a/test/es6-react/rules/react/no-did-mount-set-state.js b/test/es6-react/rules/react/no-did-mount-set-state.js index 4989a91..2296e20 100644 --- a/test/es6-react/rules/react/no-did-mount-set-state.js +++ b/test/es6-react/rules/react/no-did-mount-set-state.js @@ -39,11 +39,11 @@ const Hello = React.createClass({ constructor() { // initialState this.state = { - isLoading: true + isLoading: true, }; }, render() { return
Hello {this.state.name}
; - } + }, }); // END!> diff --git a/test/es6-react/rules/react/no-direct-mutation-state.js b/test/es6-react/rules/react/no-direct-mutation-state.js index 19f0677..c811674 100644 --- a/test/es6-react/rules/react/no-direct-mutation-state.js +++ b/test/es6-react/rules/react/no-direct-mutation-state.js @@ -40,16 +40,16 @@ const Hello = React.createClass({ const Hello2 = React.createClass({ constructor() { this.state = { - isOpen: false + isOpen: false, }; }, handleClick() { this.setState({ - isOpen: true + isOpen: true, }); }, render() { return
Hello
; - } + }, }); // END!> diff --git a/test/es6-react/rules/react/prop-types.js b/test/es6-react/rules/react/prop-types.js index 5125c39..d9976de 100644 --- a/test/es6-react/rules/react/prop-types.js +++ b/test/es6-react/rules/react/prop-types.js @@ -31,10 +31,10 @@ const Hello = React.createClass({ // Good const Hello = React.createClass({ propTypes: { - name: React.PropTypes.string.isRequired + name: React.PropTypes.string.isRequired, }, render: function () { return
Hello {this.props.name}
; - } + }, }); // END!> diff --git a/test/es6-react/rules/react/sort-prop-types.js b/test/es6-react/rules/react/sort-prop-types.js index 697b4d1..7d83619 100644 --- a/test/es6-react/rules/react/sort-prop-types.js +++ b/test/es6-react/rules/react/sort-prop-types.js @@ -24,7 +24,7 @@ Test.propTypes = { aa: React.PropTypes.object, b: React.PropTypes.object, x: React.PropTypes.object, - onClick: React.PropTypes.func + onClick: React.PropTypes.func, }; Test2.propTypes = { @@ -33,6 +33,6 @@ Test2.propTypes = { aa: React.PropTypes.object, b: React.PropTypes.object, x: React.PropTypes.object, - onClick: React.PropTypes.func + onClick: React.PropTypes.func, }; // END!>