diff --git a/.gitignore b/.gitignore index 5fe04e4..f246e76 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ /reports/** analysis.json npm-debug.log -/demo/test/snapshots/*results.txt +/demo/test/snapshots/local* diff --git a/README.md b/README.md index e207e8b..3c68033 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,22 @@ This is a shared configuration for all Tree repositories. Contains overrides and enhancements on top of the base configuration located at [https://github.com/fs-webdev/eslint-config-frontier](https://github.com/fs-webdev/eslint-config-frontier). -Why? Because we believe in linting, and we have become converted to the additional rules enforced by the following plugins: +## Unit tests + +This central configuration is a potential breaking point for _all_ of our code if we suddenly break our rules, so we have tests in place that verify that our configuration remains consistent between upgrades (primarily that we _know_ what changed), and that the extended cases that we care about are still caught. We do this by utilizing ava's snapshot ability against exported (and slightly modified) linting output and linting configuration. These files are not committed, as they are re-created on each test run, but the resulting snapshot and summary markdown file are part of version control, to make it easier to see changes. + +**Process:** + +1. Make dependency/configuration updates. +1. Run `npm test`. + - The tests should likely fail. Verify your expectations against the current [snapshot](/demo/test/snapshots/linting-config.test.js.md) file. +1. After you have your results how you want them, run `npm run test:update`. + - The tests should now pass. +1. If you want see how your changes would impact a codebase, you can either `npm link` or copy+paste the contents of `local-linting-final-config.json` temporarily into the target `.eslintrc` file. + +> TODO: Update the documentation below to be current, and not include things like Code Climate + +Why extra rules? Because we believe in linting, and we have become converted to the additional rules enforced by the following plugins: - [eslint-plugin-bestpractices](https://github.com/skye2k2/eslint-plugin-bestpractices) - [eslint-plugin-deprecate](https://github.com/AlexMost/eslint-plugin-deprecate) @@ -124,7 +139,7 @@ Or disable BOTH the desired rule and the no-eslint-disable rule: ### How to deal with `Definition for rule '{RULE}' was not found.` errors: -This is a known state when submitting a new file to Code Climate for the first time, since they do not support all of the linting extensions we wish to use. If you are seeing these warnings when linting locally, you may have `eslint` installed globally, but not the additional dependency. We do not recommend running `eslint` globally for this reason (see: https://github.com/eslint/eslint/issues/6732). All Tree repositories should include all dependencies required to be able to run `eslint` locally in their respective directories. +This is a known state when submitting a new file to Code Climate for the first time, since they do not support all of the linting extensions we wish to use. If you are seeing these warnings when linting locally, you may have `eslint` installed globally, but not the additional dependency. We do not recommend running `eslint` globally for this reason (see: https://github.com/eslint/eslint/issues/6732). All Tree repositories should include all dependencies required to be able to run `eslint` locally in their respective directories. If you have recently updated dependencies and see this error locally, then there is a possibility that your editor's linting integration is out-of-sync that can be resolved by restarting your editor. diff --git a/demo/example.js b/demo/example.js index 35ca3a9..b097190 100644 --- a/demo/example.js +++ b/demo/example.js @@ -12,6 +12,10 @@ // Hack: Note that these work, regardless of case // Here be Dragons +/** + * As long as you separate the comment block from the declaration, JSDOC rules will not be applied. But the comment will still show through many IDE's definition hot-linking. + */ + function functionWithoutJSDocWarningsBecauseTheSectionWasCompletelyExcluded () { console.log('ASHLDKFJHASKFJSDHFKJSDHFKLSDJHFLJKSDHFLKSDJFHKSDLJFHLSDKJF'); return true; diff --git a/demo/test/lint-output.js b/demo/test/lint-output.js deleted file mode 100755 index 21a81cf..0000000 --- a/demo/test/lint-output.js +++ /dev/null @@ -1,15 +0,0 @@ -import test from 'ava'; -const fileManager = require('file-manager-js'); - -test('Should have consistent rule output', async t => { - // Run previously via npm test, save off results, and read output - return fileManager.readFile('./demo/test/snapshots/new-lint-results.txt') - .then((content) => { - const eslintOutput = content.toString(); // content is instance of Buffer, so it needs to be parsed - return t.snapshot(eslintOutput); - }) - .catch((err) => { - console.log(err); - return t.fail(); - }); -}); diff --git a/demo/test/linting-config.test.js b/demo/test/linting-config.test.js new file mode 100755 index 0000000..cbea422 --- /dev/null +++ b/demo/test/linting-config.test.js @@ -0,0 +1,25 @@ +// NOTE: This test file runs against untracked files in an attempt to be an early warning system against making changes that would lose configuration that we care about. See the README for more information. + +import test from 'ava'; +const fileManager = require('file-manager-js'); + +function processFile (t, filename) { + // Run previously via npm test, save off results, and read output + return fileManager.readFile(`./demo/test/snapshots/${filename}`) + .then((content) => { + const output = content.toString(); // content is instance of Buffer, so it needs to be parsed + return t.snapshot(output); + }) + .catch((err) => { + console.log(err); // eslint-disable-line no-console -- Tests use the console. + return t.fail(); + }); +} + +test('Should apply our custom linting rules consistently', async t => { + return processFile(t, 'local-linting-output.txt'); +}); + +test('Should apply a consistent overall eslint configuration', async t => { + return processFile(t, 'local-linting-final-config.json'); // If this fails, go cry to mommy +}); diff --git a/demo/test/snapshots/format-config.js b/demo/test/snapshots/format-config.js new file mode 100644 index 0000000..d5d38bd --- /dev/null +++ b/demo/test/snapshots/format-config.js @@ -0,0 +1,43 @@ +// Process the exported linting results and final configuration files: +// Sort final configuration rules alphabetically to compare changes easier. +// Remove any developer-specific directory paths for both files. + +/* eslint no-console: "off" -- node scripts use the console, so disable for the whole file */ + +const finalConfig = require('./local-linting-final-config.json'); + +const FS = require('fs'); + +const formattedRules = Object.fromEntries( + Object.entries(finalConfig?.rules ?? {}).sort(([ruleNameA], [ruleNameB]) => { + if (ruleNameA > ruleNameB) return 1; + if (ruleNameB > ruleNameA) return -1; + return 0; + }) +); + +FS.writeFile( + './demo/test/snapshots/local-linting-final-config.json', + JSON.stringify( + { ...finalConfig, rules: formattedRules, parser: finalConfig.parser?.split('eslint-config-tree')[1] }, + null, + 2 + ), + (err) => { + if (err) console.log('There was an error writing to local-linting-final-config.json file:', err); + } +); + +FS.readFile('./demo/test/snapshots/local-linting-output.txt', 'utf8', (err, eslintOutput) => { + if (err) { + console.log('There was an error reading local-linting-output.txt', err); + } else { + FS.writeFile( + './demo/test/snapshots/local-linting-output.txt', + eslintOutput.replace(/.*demo\//g, ''), + (err2) => { + if (err2) console.log('There was an error writing to local-linting-output.txt file:', err); + } + ); + } +}); diff --git a/demo/test/snapshots/lint-output.js.md b/demo/test/snapshots/lint-output.js.md deleted file mode 100644 index 1b39739..0000000 --- a/demo/test/snapshots/lint-output.js.md +++ /dev/null @@ -1,81 +0,0 @@ -# Snapshot report for `demo/test/lint-output.js` - -The actual snapshot is saved in `lint-output.js.snap`. - -Generated by [AVA](https://ava.li). - -## Should have consistent rule output - -> Snapshot 1 - - `␊ - example.js␊ - 8:0 error Found eslint-disable without " -- comment" bestpractices/no-eslint-disable␊ - 10:1 warning Unexpected 'FIXME' comment: 'fixMe: Actually make this work' no-warning-comments␊ - 11:1 warning Unexpected 'TODO' comment: 'todo: Add documentation' no-warning-comments␊ - 12:1 warning Unexpected 'HACK' comment: 'Hack: Note that these work, regardless...' no-warning-comments␊ - 13:1 warning Unexpected 'HERE BE DRAGONS' comment: 'Here be Dragons' no-warning-comments␊ - 15:10 error 'functionWithoutJSDocWarningsBecauseTheSectionWasCompletelyExcluded' is defined but never used no-unused-vars␊ - 20:1 warning Remove the @description tag to leave a plain block description or add additional description text above the @description line jsdoc/require-description␊ - 20:1 warning JSDoc @returns declaration present but return expression not available in function jsdoc/require-returns-check␊ - 20:1 warning JSDoc type missing brace valid-jsdoc␊ - 22:0 warning Expected @param names to be "params". Got "a, params, b" jsdoc/check-param-names␊ - 22:0 warning Missing JSDoc @param "a" description jsdoc/require-param-description␊ - 23:0 warning Missing JSDoc @param "params" description jsdoc/require-param-description␊ - 23:0 warning Missing JSDoc @param "params" type jsdoc/require-param-type␊ - 24:0 warning Missing JSDoc @param "b" description jsdoc/require-param-description␊ - 24:0 warning Missing JSDoc @param "b" type jsdoc/require-param-type␊ - 25:0 warning Missing JSDoc @returns description jsdoc/require-returns-description␊ - 25:0 warning Missing JSDoc @returns type jsdoc/require-returns-type␊ - 30:19 warning Avoid creating new promises promise/avoid-new␊ - 33:0 warning Invalid JSDoc tag name "note" jsdoc/check-tag-names␊ - 35:1 warning Expected catch() or return promise/catch-or-return␊ - 36:3 warning Each then() should return a value or throw promise/always-return␊ - 36:7 error Unexpected constant condition no-constant-condition␊ - 37:5 warning Avoid wrapping return values in Promise.resolve promise/no-return-wrap␊ - 39:5 error 'forgotToDefine' is not defined no-undef␊ - 43:7 error 'variable' is assigned a value but never used no-unused-vars␊ - 43:18 warning This conditional operation returns the same value whether the condition is "true" or "false" sonarjs/no-all-duplicated-branches␊ - 43:18 error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary␊ - 43:19 error Unexpected constant condition no-constant-condition␊ - 45:5 warning Correct one of the identical sub-expressions on both sides of operator "&&" sonarjs/no-identical-expressions␊ - 45:16 warning Unexpected use of undefined no-undefined␊ - 45:40 warning Unexpected use of undefined no-undefined␊ - 45:53 error 'params' is not defined no-undef␊ - 46:3 warning This function expects 1 argument, but 2 were provided sonarjs/no-extra-arguments␊ - 47:28 error Module path/to/legacyModule is deprecated. Use module x instead deprecate/import␊ - 49:3 error Function deprecatedFunction is deprecated. Use function x from package y instead deprecate/function␊ - 49:3 error 'deprecatedFunction' is not defined no-undef␊ - 51:3 error Member expression $.each is deprecated. Use native forEach instead deprecate/member-expression␊ - 51:3 error '$' is not defined no-undef␊ - 53:3 error Unexpected 'debugger' statement no-debugger␊ - 53:3 error Unreachable code no-unreachable␊ - 66:10 warning Update this function so that its implementation is not identical to the one on line 58 sonarjs/no-identical-functions␊ - 74:1 warning Remove this conditional structure or edit its code blocks so that they're not all the same sonarjs/no-all-duplicated-branches␊ - 74:5 warning {"message":"This always evaluates to truthy. Consider refactoring this code.","secondaryLocations":[]} sonarjs/no-gratuitous-expressions␊ - 74:5 error Unexpected constant condition no-constant-condition␊ - 81:1 warning Reduce the number of non-empty switch cases from 11 to at most 10 sonarjs/max-switch-cases␊ - 85:5 warning Expected a default case default-case␊ - 85:5 warning Refactor the code to eliminate this nested "switch" sonarjs/no-nested-switch␊ - 90:7 error This case's code block is the same as the block for the case on line 86 sonarjs/no-duplicated-branches␊ - 90:7 error Duplicate case label no-duplicate-case␊ - ␊ - example.json␊ - 4:6 error Property keys must be doublequoted json/undefined␊ - 4:14 error Value expected json/value-expected␊ - 5:6 error Duplicate object key json/duplicate-key␊ - 5:12 error Colon expected json/colon-expected␊ - 6:6 error Expected comma json/comma-expected␊ - 6:20 error Trailing comma json/trailing-comma␊ - 8:3 error End of file expected json/undefined␊ - ␊ - example.test.html␊ - 2:3 warning Unexpected var, use let or const instead no-var␊ - 3:3 warning Unexpected var, use let or const instead no-var␊ - ␊ - test/lint-output.js␊ - 12:7 warning Unexpected console statement no-console␊ - ␊ - ✖ 59 problems (25 errors, 34 warnings)␊ - 0 errors and 2 warnings potentially fixable with the `--fix` option.␊ - ` diff --git a/demo/test/snapshots/lint-output.js.snap b/demo/test/snapshots/lint-output.js.snap deleted file mode 100644 index f4e94c4..0000000 Binary files a/demo/test/snapshots/lint-output.js.snap and /dev/null differ diff --git a/demo/test/snapshots/linting-config.test.js.md b/demo/test/snapshots/linting-config.test.js.md new file mode 100644 index 0000000..26b6b8d --- /dev/null +++ b/demo/test/snapshots/linting-config.test.js.md @@ -0,0 +1,1369 @@ +# Snapshot report for `demo/test/linting-config.test.js` + +The actual snapshot is saved in `linting-config.test.js.snap`. + +Generated by [AVA](https://ava.li). + +## Should apply a consistent overall eslint configuration + +> Snapshot 1 + + `{␊ + "env": {␊ + "browser": true,␊ + "mocha": true,␊ + "es2021": true,␊ + "node": true,␊ + "es6": true␊ + },␊ + "globals": {␊ + "__services__": true,␊ + "assert": true,␊ + "axe": true,␊ + "customElements": true,␊ + "CustomEvent": true,␊ + "d3": true,␊ + "Event": true,␊ + "expect": true,␊ + "fixture": true,␊ + "google": true,␊ + "FS": true,␊ + "FsBehaviors": true,␊ + "FSResearchHelpService": true,␊ + "FSTreeCommonRoutingService": true,␊ + "Headers": true,␊ + "HF": true,␊ + "HTMLElement": true,␊ + "indexedDB": true,␊ + "location": true,␊ + "Polymer": true,␊ + "ResettablePropertiesBehavior": true,␊ + "sessionStorage": true,␊ + "sinon": true,␊ + "WCI18n": true,␊ + "WCT": true,␊ + "document": "readonly",␊ + "navigator": "readonly",␊ + "window": "readonly"␊ + },␊ + "parser": "/node_modules/babel-eslint/lib/index.js",␊ + "parserOptions": {␊ + "ecmaVersion": 2021,␊ + "ecmaFeatures": {␊ + "jsx": true␊ + },␊ + "sourceType": "module"␊ + },␊ + "plugins": [␊ + "node",␊ + "import",␊ + "json",␊ + "jsdoc",␊ + "html",␊ + "test-selectors",␊ + "sonarjs",␊ + "promise",␊ + "deprecate",␊ + "bestpractices"␊ + ],␊ + "rules": {␊ + "accessor-pairs": [␊ + "error",␊ + {␊ + "setWithoutGet": true,␊ + "enforceForClassMembers": true,␊ + "getWithoutSet": false␊ + }␊ + ],␊ + "array-bracket-spacing": [␊ + "warn",␊ + "never"␊ + ],␊ + "array-callback-return": [␊ + "error",␊ + {␊ + "allowImplicit": false,␊ + "checkForEach": false␊ + }␊ + ],␊ + "arrow-spacing": [␊ + "error",␊ + {␊ + "before": true,␊ + "after": true␊ + }␊ + ],␊ + "bestpractices/no-eslint-disable": [␊ + "warn"␊ + ],␊ + "block-spacing": [␊ + "error",␊ + "always"␊ + ],␊ + "brace-style": [␊ + "error",␊ + "1tbs",␊ + {␊ + "allowSingleLine": true␊ + }␊ + ],␊ + "camelcase": [␊ + "error",␊ + {␊ + "allow": [␊ + "^UNSAFE_"␊ + ],␊ + "properties": "never",␊ + "ignoreGlobals": true,␊ + "ignoreDestructuring": false,␊ + "ignoreImports": false␊ + }␊ + ],␊ + "comma-dangle": [␊ + "error",␊ + {␊ + "arrays": "never",␊ + "objects": "never",␊ + "imports": "never",␊ + "exports": "never",␊ + "functions": "never"␊ + }␊ + ],␊ + "comma-spacing": [␊ + "error",␊ + {␊ + "before": false,␊ + "after": true␊ + }␊ + ],␊ + "comma-style": [␊ + "error",␊ + "last"␊ + ],␊ + "complexity": [␊ + "warn",␊ + {␊ + "max": 8␊ + }␊ + ],␊ + "computed-property-spacing": [␊ + "error",␊ + "never",␊ + {␊ + "enforceForClassMembers": true␊ + }␊ + ],␊ + "constructor-super": [␊ + "error"␊ + ],␊ + "curly": [␊ + "error",␊ + "multi-line"␊ + ],␊ + "default-case": [␊ + "warn"␊ + ],␊ + "default-case-last": [␊ + "error"␊ + ],␊ + "deprecate/function": [␊ + "error",␊ + {␊ + "name": "deprecatedFunction",␊ + "use": "function x from package y"␊ + }␊ + ],␊ + "deprecate/import": [␊ + "error",␊ + {␊ + "name": "path/to/legacyModule",␊ + "use": "module x"␊ + }␊ + ],␊ + "deprecate/member-expression": [␊ + "error",␊ + {␊ + "name": "$.each",␊ + "use": "native forEach"␊ + }␊ + ],␊ + "dot-location": [␊ + "error",␊ + "property"␊ + ],␊ + "dot-notation": [␊ + "error",␊ + {␊ + "allowKeywords": true,␊ + "allowPattern": ""␊ + }␊ + ],␊ + "eol-last": [␊ + "error"␊ + ],␊ + "eqeqeq": [␊ + "error",␊ + "always",␊ + {␊ + "null": "ignore"␊ + }␊ + ],␊ + "func-call-spacing": [␊ + "error",␊ + "never"␊ + ],␊ + "generator-star-spacing": [␊ + "error",␊ + {␊ + "before": true,␊ + "after": true␊ + }␊ + ],␊ + "guard-for-in": [␊ + "warn"␊ + ],␊ + "import/export": [␊ + "error"␊ + ],␊ + "import/first": [␊ + "error"␊ + ],␊ + "import/no-absolute-path": [␊ + "warn",␊ + {␊ + "esmodule": true,␊ + "commonjs": true,␊ + "amd": false␊ + }␊ + ],␊ + "import/no-duplicates": [␊ + "error"␊ + ],␊ + "import/no-named-default": [␊ + "error"␊ + ],␊ + "import/no-webpack-loader-syntax": [␊ + "error"␊ + ],␊ + "indent": [␊ + "error",␊ + 2,␊ + {␊ + "SwitchCase": 1,␊ + "VariableDeclarator": 1,␊ + "outerIIFEBody": 1,␊ + "MemberExpression": 1,␊ + "FunctionDeclaration": {␊ + "parameters": 1,␊ + "body": 1␊ + },␊ + "FunctionExpression": {␊ + "parameters": 1,␊ + "body": 1␊ + },␊ + "CallExpression": {␊ + "arguments": 1␊ + },␊ + "ArrayExpression": 1,␊ + "ObjectExpression": 1,␊ + "ImportDeclaration": 1,␊ + "flatTernaryExpressions": false,␊ + "ignoreComments": false,␊ + "ignoredNodes": [␊ + "TemplateLiteral *",␊ + "JSXElement",␊ + "JSXElement > *",␊ + "JSXAttribute",␊ + "JSXIdentifier",␊ + "JSXNamespacedName",␊ + "JSXMemberExpression",␊ + "JSXSpreadAttribute",␊ + "JSXExpressionContainer",␊ + "JSXOpeningElement",␊ + "JSXClosingElement",␊ + "JSXFragment",␊ + "JSXOpeningFragment",␊ + "JSXClosingFragment",␊ + "JSXText",␊ + "JSXEmptyExpression",␊ + "JSXSpreadChild"␊ + ],␊ + "offsetTernaryExpressions": true␊ + }␊ + ],␊ + "jsdoc/check-access": [␊ + "off"␊ + ],␊ + "jsdoc/check-alignment": [␊ + "warn"␊ + ],␊ + "jsdoc/check-examples": [␊ + "warn"␊ + ],␊ + "jsdoc/check-indentation": [␊ + "off"␊ + ],␊ + "jsdoc/check-param-names": [␊ + "warn"␊ + ],␊ + "jsdoc/check-syntax": [␊ + "warn"␊ + ],␊ + "jsdoc/check-tag-names": [␊ + "warn"␊ + ],␊ + "jsdoc/check-types": [␊ + "warn"␊ + ],␊ + "jsdoc/implements-on-classes": [␊ + "warn"␊ + ],␊ + "jsdoc/match-description": [␊ + "warn"␊ + ],␊ + "jsdoc/newline-after-description": [␊ + "off"␊ + ],␊ + "jsdoc/no-types": [␊ + "off"␊ + ],␊ + "jsdoc/no-undefined-types": [␊ + "off"␊ + ],␊ + "jsdoc/require-description": [␊ + "warn"␊ + ],␊ + "jsdoc/require-description-complete-sentence": [␊ + "off"␊ + ],␊ + "jsdoc/require-example": [␊ + "off"␊ + ],␊ + "jsdoc/require-file-overview": [␊ + "off"␊ + ],␊ + "jsdoc/require-hyphen-before-param-description": [␊ + "warn"␊ + ],␊ + "jsdoc/require-jsdoc": [␊ + "off"␊ + ],␊ + "jsdoc/require-param": [␊ + "warn"␊ + ],␊ + "jsdoc/require-param-description": [␊ + "warn"␊ + ],␊ + "jsdoc/require-param-name": [␊ + "warn"␊ + ],␊ + "jsdoc/require-param-type": [␊ + "warn"␊ + ],␊ + "jsdoc/require-returns": [␊ + "warn"␊ + ],␊ + "jsdoc/require-returns-check": [␊ + "warn"␊ + ],␊ + "jsdoc/require-returns-description": [␊ + "warn"␊ + ],␊ + "jsdoc/require-returns-type": [␊ + "warn"␊ + ],␊ + "jsdoc/require-throws": [␊ + "off"␊ + ],␊ + "jsdoc/valid-types": [␊ + "warn"␊ + ],␊ + "json/colon-expected": [␊ + "error"␊ + ],␊ + "json/comma-expected": [␊ + "error"␊ + ],␊ + "json/comma-or-close-backet-expected": [␊ + "error"␊ + ],␊ + "json/comma-or-close-brace-expected": [␊ + "error"␊ + ],␊ + "json/comment-not-permitted": [␊ + "error"␊ + ],␊ + "json/duplicate-key": [␊ + "error"␊ + ],␊ + "json/enum-value-mismatch": [␊ + "error"␊ + ],␊ + "json/invalid-character": [␊ + "error"␊ + ],␊ + "json/invalid-escape-character": [␊ + "error"␊ + ],␊ + "json/invalid-unicode": [␊ + "error"␊ + ],␊ + "json/property-expected": [␊ + "error"␊ + ],␊ + "json/schema-resolve-error": [␊ + "error"␊ + ],␊ + "json/trailing-comma": [␊ + "error"␊ + ],␊ + "json/undefined": [␊ + "error"␊ + ],␊ + "json/unexpected-end-of-comment": [␊ + "error"␊ + ],␊ + "json/unexpected-end-of-number": [␊ + "error"␊ + ],␊ + "json/unexpected-end-of-string": [␊ + "error"␊ + ],␊ + "json/unknown": [␊ + "error"␊ + ],␊ + "json/value-expected": [␊ + "error"␊ + ],␊ + "jsx-quotes": [␊ + "off"␊ + ],␊ + "key-spacing": [␊ + "error",␊ + {␊ + "beforeColon": false,␊ + "afterColon": true␊ + }␊ + ],␊ + "keyword-spacing": [␊ + "error",␊ + {␊ + "before": true,␊ + "after": true␊ + }␊ + ],␊ + "lines-between-class-members": [␊ + "warn",␊ + "always",␊ + {␊ + "exceptAfterSingleLine": true␊ + }␊ + ],␊ + "multiline-ternary": [␊ + "error",␊ + "always-multiline"␊ + ],␊ + "new-cap": [␊ + "error",␊ + {␊ + "newIsCap": true,␊ + "capIsNew": false,␊ + "properties": true␊ + }␊ + ],␊ + "new-parens": [␊ + "error"␊ + ],␊ + "no-alert": [␊ + "error"␊ + ],␊ + "no-array-constructor": [␊ + "error"␊ + ],␊ + "no-async-promise-executor": [␊ + "error"␊ + ],␊ + "no-caller": [␊ + "error"␊ + ],␊ + "no-case-declarations": [␊ + "off"␊ + ],␊ + "no-catch-shadow": [␊ + "error"␊ + ],␊ + "no-class-assign": [␊ + "error"␊ + ],␊ + "no-compare-neg-zero": [␊ + "error"␊ + ],␊ + "no-cond-assign": [␊ + "error"␊ + ],␊ + "no-console": [␊ + "warn"␊ + ],␊ + "no-const-assign": [␊ + "error"␊ + ],␊ + "no-constant-condition": [␊ + "error",␊ + {␊ + "checkLoops": false␊ + }␊ + ],␊ + "no-control-regex": [␊ + "error"␊ + ],␊ + "no-debugger": [␊ + "error"␊ + ],␊ + "no-delete-var": [␊ + "error"␊ + ],␊ + "no-div-regex": [␊ + "error"␊ + ],␊ + "no-dupe-args": [␊ + "error"␊ + ],␊ + "no-dupe-class-members": [␊ + "error"␊ + ],␊ + "no-dupe-keys": [␊ + "error"␊ + ],␊ + "no-duplicate-case": [␊ + "error"␊ + ],␊ + "no-else-return": [␊ + "off"␊ + ],␊ + "no-empty": [␊ + "error",␊ + {␊ + "allowEmptyCatch": true␊ + }␊ + ],␊ + "no-empty-character-class": [␊ + "error"␊ + ],␊ + "no-empty-pattern": [␊ + "error"␊ + ],␊ + "no-eq-null": [␊ + "error"␊ + ],␊ + "no-eval": [␊ + "error"␊ + ],␊ + "no-ex-assign": [␊ + "error"␊ + ],␊ + "no-extend-native": [␊ + "error"␊ + ],␊ + "no-extra-bind": [␊ + "error"␊ + ],␊ + "no-extra-boolean-cast": [␊ + "error"␊ + ],␊ + "no-extra-label": [␊ + "warn"␊ + ],␊ + "no-extra-parens": [␊ + "error",␊ + "functions"␊ + ],␊ + "no-extra-semi": [␊ + "error"␊ + ],␊ + "no-fallthrough": [␊ + "error"␊ + ],␊ + "no-floating-decimal": [␊ + "error"␊ + ],␊ + "no-func-assign": [␊ + "error"␊ + ],␊ + "no-global-assign": [␊ + "error"␊ + ],␊ + "no-implicit-globals": [␊ + "warn"␊ + ],␊ + "no-implied-eval": [␊ + "error"␊ + ],␊ + "no-import-assign": [␊ + "error"␊ + ],␊ + "no-inner-declarations": [␊ + "error"␊ + ],␊ + "no-invalid-regexp": [␊ + "error"␊ + ],␊ + "no-invalid-this": [␊ + "off"␊ + ],␊ + "no-irregular-whitespace": [␊ + "error"␊ + ],␊ + "no-iterator": [␊ + "error"␊ + ],␊ + "no-label-var": [␊ + "error"␊ + ],␊ + "no-labels": [␊ + "error",␊ + {␊ + "allowLoop": false,␊ + "allowSwitch": false␊ + }␊ + ],␊ + "no-lone-blocks": [␊ + "error"␊ + ],␊ + "no-loop-func": [␊ + "error"␊ + ],␊ + "no-loss-of-precision": [␊ + "error"␊ + ],␊ + "no-magic-numbers": [␊ + "off"␊ + ],␊ + "no-misleading-character-class": [␊ + "error"␊ + ],␊ + "no-mixed-operators": [␊ + "error",␊ + {␊ + "groups": [␊ + [␊ + "==",␊ + "!=",␊ + "===",␊ + "!==",␊ + ">",␊ + ">=",␊ + "<",␊ + "<="␊ + ],␊ + [␊ + "&&",␊ + "||"␊ + ],␊ + [␊ + "in",␊ + "instanceof"␊ + ]␊ + ],␊ + "allowSamePrecedence": true␊ + }␊ + ],␊ + "no-mixed-spaces-and-tabs": [␊ + "error"␊ + ],␊ + "no-multi-spaces": [␊ + "error"␊ + ],␊ + "no-multi-str": [␊ + "error"␊ + ],␊ + "no-multiple-empty-lines": [␊ + "error",␊ + {␊ + "max": 1,␊ + "maxEOF": 0␊ + }␊ + ],␊ + "no-native-reassign": [␊ + "error"␊ + ],␊ + "no-new": [␊ + "error"␊ + ],␊ + "no-new-func": [␊ + "error"␊ + ],␊ + "no-new-object": [␊ + "error"␊ + ],␊ + "no-new-symbol": [␊ + "error"␊ + ],␊ + "no-new-wrappers": [␊ + "error"␊ + ],␊ + "no-obj-calls": [␊ + "error"␊ + ],␊ + "no-octal": [␊ + "error"␊ + ],␊ + "no-octal-escape": [␊ + "error"␊ + ],␊ + "no-param-reassign": [␊ + "warn"␊ + ],␊ + "no-process-env": [␊ + "off"␊ + ],␊ + "no-proto": [␊ + "error"␊ + ],␊ + "no-prototype-builtins": [␊ + "warn"␊ + ],␊ + "no-redeclare": [␊ + "error",␊ + {␊ + "builtinGlobals": false␊ + }␊ + ],␊ + "no-regex-spaces": [␊ + "error"␊ + ],␊ + "no-return-assign": [␊ + "error",␊ + "except-parens"␊ + ],␊ + "no-script-url": [␊ + "error"␊ + ],␊ + "no-self-assign": [␊ + "error",␊ + {␊ + "props": true␊ + }␊ + ],␊ + "no-self-compare": [␊ + "error"␊ + ],␊ + "no-sequences": [␊ + "error"␊ + ],␊ + "no-shadow": [␊ + "warn"␊ + ],␊ + "no-shadow-restricted-names": [␊ + "error"␊ + ],␊ + "no-sparse-arrays": [␊ + "error"␊ + ],␊ + "no-tabs": [␊ + "error"␊ + ],␊ + "no-template-curly-in-string": [␊ + "error"␊ + ],␊ + "no-this-before-super": [␊ + "error"␊ + ],␊ + "no-throw-literal": [␊ + "error"␊ + ],␊ + "no-trailing-spaces": [␊ + "error"␊ + ],␊ + "no-undef": [␊ + "error"␊ + ],␊ + "no-undef-init": [␊ + "error"␊ + ],␊ + "no-undefined": [␊ + "warn"␊ + ],␊ + "no-unexpected-multiline": [␊ + "error"␊ + ],␊ + "no-unmodified-loop-condition": [␊ + "error"␊ + ],␊ + "no-unneeded-ternary": [␊ + "error",␊ + {␊ + "defaultAssignment": false␊ + }␊ + ],␊ + "no-unreachable": [␊ + "error"␊ + ],␊ + "no-unreachable-loop": [␊ + "error"␊ + ],␊ + "no-unsafe-finally": [␊ + "error"␊ + ],␊ + "no-unsafe-negation": [␊ + "error"␊ + ],␊ + "no-unused-expressions": [␊ + "error",␊ + {␊ + "allowShortCircuit": true,␊ + "allowTernary": true,␊ + "allowTaggedTemplates": true,␊ + "enforceForJSX": false␊ + }␊ + ],␊ + "no-unused-labels": [␊ + "error"␊ + ],␊ + "no-unused-vars": [␊ + "error",␊ + {␊ + "args": "none",␊ + "caughtErrors": "none",␊ + "ignoreRestSiblings": true,␊ + "vars": "all"␊ + }␊ + ],␊ + "no-use-before-define": [␊ + "error",␊ + {␊ + "functions": false,␊ + "classes": false,␊ + "variables": false␊ + }␊ + ],␊ + "no-useless-backreference": [␊ + "error"␊ + ],␊ + "no-useless-call": [␊ + "error"␊ + ],␊ + "no-useless-catch": [␊ + "error"␊ + ],␊ + "no-useless-computed-key": [␊ + "error"␊ + ],␊ + "no-useless-concat": [␊ + "error"␊ + ],␊ + "no-useless-constructor": [␊ + "error"␊ + ],␊ + "no-useless-escape": [␊ + "error"␊ + ],␊ + "no-useless-rename": [␊ + "error"␊ + ],␊ + "no-useless-return": [␊ + "error"␊ + ],␊ + "no-var": [␊ + "warn"␊ + ],␊ + "no-void": [␊ + "error"␊ + ],␊ + "no-warning-comments": [␊ + "warn",␊ + {␊ + "terms": [␊ + "FIXME",␊ + "TODO",␊ + "TO-DO",␊ + "HACK",␊ + "HERE BE DRAGONS"␊ + ],␊ + "location": "anywhere"␊ + }␊ + ],␊ + "no-whitespace-before-property": [␊ + "error"␊ + ],␊ + "no-with": [␊ + "error"␊ + ],␊ + "node/handle-callback-err": [␊ + "error",␊ + "^(err|error)$"␊ + ],␊ + "node/no-callback-literal": [␊ + "error"␊ + ],␊ + "node/no-deprecated-api": [␊ + "error"␊ + ],␊ + "node/no-exports-assign": [␊ + "error"␊ + ],␊ + "node/no-new-require": [␊ + "error"␊ + ],␊ + "node/no-path-concat": [␊ + "error"␊ + ],␊ + "node/process-exit-as-throw": [␊ + "error"␊ + ],␊ + "object-curly-newline": [␊ + "warn",␊ + {␊ + "multiline": true,␊ + "consistent": true␊ + }␊ + ],␊ + "object-curly-spacing": [␊ + "off",␊ + "always"␊ + ],␊ + "object-property-newline": [␊ + "error",␊ + {␊ + "allowMultiplePropertiesPerLine": true,␊ + "allowAllPropertiesOnSameLine": false␊ + }␊ + ],␊ + "one-var": [␊ + "error",␊ + {␊ + "initialized": "never"␊ + }␊ + ],␊ + "operator-linebreak": [␊ + "error",␊ + "after",␊ + {␊ + "overrides": {␊ + "?": "before",␊ + ":": "before",␊ + "|>": "before"␊ + }␊ + }␊ + ],␊ + "padded-blocks": [␊ + "error",␊ + {␊ + "blocks": "never",␊ + "switches": "never",␊ + "classes": "never"␊ + }␊ + ],␊ + "prefer-const": [␊ + "warn",␊ + {␊ + "destructuring": "all",␊ + "ignoreReadBeforeAssign": false␊ + }␊ + ],␊ + "prefer-promise-reject-errors": [␊ + "error"␊ + ],␊ + "prefer-regex-literals": [␊ + "error",␊ + {␊ + "disallowRedundantWrapping": true␊ + }␊ + ],␊ + "promise/always-return": [␊ + "warn"␊ + ],␊ + "promise/avoid-new": [␊ + "warn"␊ + ],␊ + "promise/catch-or-return": [␊ + "warn",␊ + {␊ + "allowFinally": true␊ + }␊ + ],␊ + "promise/no-callback-in-promise": [␊ + "warn"␊ + ],␊ + "promise/no-native": [␊ + "off"␊ + ],␊ + "promise/no-nesting": [␊ + "warn"␊ + ],␊ + "promise/no-new-statics": [␊ + "warn"␊ + ],␊ + "promise/no-promise-in-callback": [␊ + "warn"␊ + ],␊ + "promise/no-return-in-finally": [␊ + "warn"␊ + ],␊ + "promise/no-return-wrap": [␊ + "warn"␊ + ],␊ + "promise/param-names": [␊ + "warn"␊ + ],␊ + "promise/valid-params": [␊ + "warn"␊ + ],␊ + "quote-props": [␊ + "off",␊ + "as-needed"␊ + ],␊ + "quotes": [␊ + "off",␊ + "single",␊ + {␊ + "avoidEscape": true,␊ + "allowTemplateLiterals": false␊ + }␊ + ],␊ + "radix": [␊ + "error"␊ + ],␊ + "rest-spread-spacing": [␊ + "error",␊ + "never"␊ + ],␊ + "semi": [␊ + "error",␊ + "always"␊ + ],␊ + "semi-spacing": [␊ + "error",␊ + {␊ + "before": false,␊ + "after": true␊ + }␊ + ],␊ + "sonarjs/cognitive-complexity": [␊ + "warn",␊ + 25␊ + ],␊ + "sonarjs/max-switch-cases": [␊ + "warn",␊ + 10␊ + ],␊ + "sonarjs/no-all-duplicated-branches": [␊ + "warn"␊ + ],␊ + "sonarjs/no-collapsible-if": [␊ + "warn"␊ + ],␊ + "sonarjs/no-duplicate-string": [␊ + "warn"␊ + ],␊ + "sonarjs/no-duplicated-branches": [␊ + "warn"␊ + ],␊ + "sonarjs/no-element-overwrite": [␊ + "warn"␊ + ],␊ + "sonarjs/no-empty-collection": [␊ + "warn"␊ + ],␊ + "sonarjs/no-extra-arguments": [␊ + "warn"␊ + ],␊ + "sonarjs/no-gratuitous-expressions": [␊ + "warn"␊ + ],␊ + "sonarjs/no-identical-conditions": [␊ + "warn"␊ + ],␊ + "sonarjs/no-identical-expressions": [␊ + "warn"␊ + ],␊ + "sonarjs/no-identical-functions": [␊ + "warn"␊ + ],␊ + "sonarjs/no-inverted-boolean-check": [␊ + "off"␊ + ],␊ + "sonarjs/no-nested-switch": [␊ + "warn"␊ + ],␊ + "sonarjs/no-nested-template-literals": [␊ + "warn"␊ + ],␊ + "sonarjs/no-one-iteration-loop": [␊ + "warn"␊ + ],␊ + "sonarjs/no-redundant-boolean": [␊ + "warn"␊ + ],␊ + "sonarjs/no-redundant-jump": [␊ + "warn"␊ + ],␊ + "sonarjs/no-same-line-conditional": [␊ + "warn"␊ + ],␊ + "sonarjs/no-small-switch": [␊ + "warn"␊ + ],␊ + "sonarjs/no-unused-collection": [␊ + "warn"␊ + ],␊ + "sonarjs/no-use-of-empty-return-value": [␊ + "warn"␊ + ],␊ + "sonarjs/no-useless-catch": [␊ + "warn"␊ + ],␊ + "sonarjs/non-existent-operator": [␊ + "warn"␊ + ],␊ + "sonarjs/prefer-immediate-return": [␊ + "warn"␊ + ],␊ + "sonarjs/prefer-object-literal": [␊ + "warn"␊ + ],␊ + "sonarjs/prefer-single-boolean-return": [␊ + "warn"␊ + ],␊ + "sonarjs/prefer-while": [␊ + "warn"␊ + ],␊ + "space-before-blocks": [␊ + "error",␊ + "always"␊ + ],␊ + "space-before-function-paren": [␊ + "error",␊ + "always"␊ + ],␊ + "space-in-parens": [␊ + "error",␊ + "never"␊ + ],␊ + "space-infix-ops": [␊ + "error"␊ + ],␊ + "space-unary-ops": [␊ + "error",␊ + {␊ + "words": true,␊ + "nonwords": false␊ + }␊ + ],␊ + "spaced-comment": [␊ + "error",␊ + "always",␊ + {␊ + "line": {␊ + "markers": [␊ + "*package",␊ + "!",␊ + "/",␊ + ",",␊ + "="␊ + ]␊ + },␊ + "block": {␊ + "balanced": true,␊ + "markers": [␊ + "*package",␊ + "!",␊ + ",",␊ + ":",␊ + "::",␊ + "flow-include"␊ + ],␊ + "exceptions": [␊ + "*"␊ + ]␊ + }␊ + }␊ + ],␊ + "strict": [␊ + "off"␊ + ],␊ + "symbol-description": [␊ + "error"␊ + ],␊ + "template-curly-spacing": [␊ + "error",␊ + "never"␊ + ],␊ + "template-tag-spacing": [␊ + "error",␊ + "never"␊ + ],␊ + "test-selectors/anchor": [␊ + "warn",␊ + "always",␊ + {␊ + "ignoreDisabled": false,␊ + "ignoreReadonly": false,␊ + "testAttribute": "data-testid"␊ + }␊ + ],␊ + "test-selectors/button": [␊ + "warn",␊ + "always",␊ + {␊ + "ignoreDisabled": false,␊ + "ignoreReadonly": false,␊ + "testAttribute": "data-testid"␊ + }␊ + ],␊ + "test-selectors/input": [␊ + "warn",␊ + "always",␊ + {␊ + "ignoreDisabled": false,␊ + "ignoreReadonly": false,␊ + "testAttribute": "data-testid"␊ + }␊ + ],␊ + "test-selectors/onChange": [␊ + "warn",␊ + "always",␊ + {␊ + "ignoreDisabled": false,␊ + "ignoreReadonly": false,␊ + "testAttribute": "data-testid"␊ + }␊ + ],␊ + "test-selectors/onClick": [␊ + "warn",␊ + "always",␊ + {␊ + "ignoreDisabled": false,␊ + "ignoreReadonly": false,␊ + "testAttribute": "data-testid"␊ + }␊ + ],␊ + "test-selectors/onKeyDown": [␊ + "warn",␊ + "always",␊ + {␊ + "ignoreDisabled": false,␊ + "ignoreReadonly": false,␊ + "testAttribute": "data-testid"␊ + }␊ + ],␊ + "test-selectors/onKeyUp": [␊ + "warn",␊ + "always",␊ + {␊ + "ignoreDisabled": false,␊ + "ignoreReadonly": false,␊ + "testAttribute": "data-testid"␊ + }␊ + ],␊ + "unicode-bom": [␊ + "error",␊ + "never"␊ + ],␊ + "use-isnan": [␊ + "error",␊ + {␊ + "enforceForSwitchCase": true,␊ + "enforceForIndexOf": true␊ + }␊ + ],␊ + "valid-jsdoc": [␊ + "warn"␊ + ],␊ + "valid-typeof": [␊ + "error",␊ + {␊ + "requireStringLiterals": true␊ + }␊ + ],␊ + "wrap-iife": [␊ + "error",␊ + "any",␊ + {␊ + "functionPrototypeMethods": true␊ + }␊ + ],␊ + "yield-star-spacing": [␊ + "error",␊ + "both"␊ + ],␊ + "yoda": [␊ + "error",␊ + "never"␊ + ]␊ + },␊ + "settings": {},␊ + "ignorePatterns": []␊ + }` + +## Should apply our custom linting rules consistently + +> Snapshot 1 + + `␊ + example.js␊ + 8:0 error Found eslint-disable without " -- comment" bestpractices/no-eslint-disable␊ + 10:1 warning Unexpected 'FIXME' comment: 'fixMe: Actually make this work' no-warning-comments␊ + 11:1 warning Unexpected 'TODO' comment: 'todo: Add documentation' no-warning-comments␊ + 12:1 warning Unexpected 'HACK' comment: 'Hack: Note that these work, regardless...' no-warning-comments␊ + 13:1 warning Unexpected 'HERE BE DRAGONS' comment: 'Here be Dragons' no-warning-comments␊ + 19:10 error 'functionWithoutJSDocWarningsBecauseTheSectionWasCompletelyExcluded' is defined but never used no-unused-vars␊ + 24:1 warning Remove the @description tag to leave a plain block description or add additional description text above the @description line jsdoc/require-description␊ + 24:1 warning JSDoc @returns declaration present but return expression not available in function jsdoc/require-returns-check␊ + 24:1 warning JSDoc type missing brace valid-jsdoc␊ + 26:0 warning Expected @param names to be "params". Got "a, params, b" jsdoc/check-param-names␊ + 26:0 warning Missing JSDoc @param "a" description jsdoc/require-param-description␊ + 27:0 warning Missing JSDoc @param "params" description jsdoc/require-param-description␊ + 27:0 warning Missing JSDoc @param "params" type jsdoc/require-param-type␊ + 28:0 warning Missing JSDoc @param "b" description jsdoc/require-param-description␊ + 28:0 warning Missing JSDoc @param "b" type jsdoc/require-param-type␊ + 29:0 warning Missing JSDoc @returns description jsdoc/require-returns-description␊ + 29:0 warning Missing JSDoc @returns type jsdoc/require-returns-type␊ + 34:19 warning Avoid creating new promises promise/avoid-new␊ + 37:0 warning Invalid JSDoc tag name "note" jsdoc/check-tag-names␊ + 39:1 warning Expected catch() or return promise/catch-or-return␊ + 40:3 warning Each then() should return a value or throw promise/always-return␊ + 40:7 error Unexpected constant condition no-constant-condition␊ + 41:5 warning Avoid wrapping return values in Promise.resolve promise/no-return-wrap␊ + 43:5 error 'forgotToDefine' is not defined no-undef␊ + 47:7 error 'variable' is assigned a value but never used no-unused-vars␊ + 47:18 warning This conditional operation returns the same value whether the condition is "true" or "false" sonarjs/no-all-duplicated-branches␊ + 47:18 error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary␊ + 47:19 error Unexpected constant condition no-constant-condition␊ + 49:5 warning Correct one of the identical sub-expressions on both sides of operator "&&" sonarjs/no-identical-expressions␊ + 49:16 warning Unexpected use of undefined no-undefined␊ + 49:40 warning Unexpected use of undefined no-undefined␊ + 49:53 error 'params' is not defined no-undef␊ + 50:3 warning This function expects 1 argument, but 2 were provided sonarjs/no-extra-arguments␊ + 51:28 error Module path/to/legacyModule is deprecated. Use module x instead deprecate/import␊ + 53:3 error Function deprecatedFunction is deprecated. Use function x from package y instead deprecate/function␊ + 53:3 error 'deprecatedFunction' is not defined no-undef␊ + 55:3 error Member expression $.each is deprecated. Use native forEach instead deprecate/member-expression␊ + 55:3 error '$' is not defined no-undef␊ + 57:3 error Unexpected 'debugger' statement no-debugger␊ + 57:3 error Unreachable code no-unreachable␊ + 70:10 warning Update this function so that its implementation is not identical to the one on line 62 sonarjs/no-identical-functions␊ + 78:1 warning Remove this conditional structure or edit its code blocks so that they're not all the same sonarjs/no-all-duplicated-branches␊ + 78:5 warning {"message":"This always evaluates to truthy. Consider refactoring this code.","secondaryLocations":[]} sonarjs/no-gratuitous-expressions␊ + 78:5 error Unexpected constant condition no-constant-condition␊ + 85:1 warning Reduce the number of non-empty switch cases from 11 to at most 10 sonarjs/max-switch-cases␊ + 89:5 warning Expected a default case default-case␊ + 89:5 warning Refactor the code to eliminate this nested "switch" sonarjs/no-nested-switch␊ + 94:7 error This case's code block is the same as the block for the case on line 90 sonarjs/no-duplicated-branches␊ + 94:7 error Duplicate case label no-duplicate-case␊ + ␊ + example.json␊ + 4:6 error Property keys must be doublequoted json/undefined␊ + 4:14 error Value expected json/value-expected␊ + 5:6 error Duplicate object key json/duplicate-key␊ + 5:12 error Colon expected json/colon-expected␊ + 6:6 error Expected comma json/comma-expected␊ + 6:20 error Trailing comma json/trailing-comma␊ + 8:3 error End of file expected json/undefined␊ + ␊ + example.test.html␊ + 2:3 warning Unexpected var, use let or const instead no-var␊ + 3:3 warning Unexpected var, use let or const instead no-var␊ + ␊ + ✖ 58 problems (25 errors, 33 warnings)␊ + 0 errors and 2 warnings potentially fixable with the `--fix` option.␊ + ` diff --git a/demo/test/snapshots/linting-config.test.js.snap b/demo/test/snapshots/linting-config.test.js.snap new file mode 100644 index 0000000..adb7355 Binary files /dev/null and b/demo/test/snapshots/linting-config.test.js.snap differ diff --git a/package.json b/package.json index 0c13d77..46158e5 100644 --- a/package.json +++ b/package.json @@ -52,15 +52,15 @@ "eslint": "^7" }, "scripts": { - "lint": "eslint --ignore-pattern '.*' '**/*.html' '**/*.js' '**/*.json'", - "lint:fix": "eslint --ignore-pattern '.*' '**/*.html' '**/*.js' '**/*.json' --fix", - "lint:quiet": "eslint --ignore-pattern '.*' '**/*.html' '**/*.js' '**/*.json' --quiet", - "lint:report": "eslint --ignore-pattern '.*' '**/*.html' '**/*.js' '**/*.json' '**/*.html' --format html --output-file ./reports/linter/lintresults.html & eslint --ignore-pattern '.*' '**/*.js' '**/*.json' --format json --output-file ./reports/linter/lintresults.json", - "lint:snapshot": "eslint --ignore-pattern '.*' '**/*.html' '**/*.js' '**/*.json' --no-color --output-file ./demo/test/snapshots/new-lint-results.txt; npm run test:format", + "lint": "eslint demo --ext .html,.js,.json", + "lint:fix": "eslint demo --ext .html,.js,.json --fix", + "lint:quiet": "eslint demo --ext .html,.js,.json --quiet", + "lint:report": "eslint demo --ext .html,.js,.json '**/*.html' --format html --output-file ./reports/linting/linting_report.html & eslint demo --ext .html,.js,.json --format json --output-file ./reports/linting/linting_report.json", + "lint:snapshot": "eslint demo --ext .html,.js,.json --no-color --output-file ./demo/test/snapshots/local-linting-output.txt; eslint --print-config file.js > ./demo/test/snapshots/local-linting-final-config.json; npm run test:format", "preinstall": "git config --global url.https://github.com/.insteadOf git://github.com/", "postinstall": "npm rebuild husky", "test": "npm run lint:snapshot; ava", - "test:format": "sed -i '' 's|^.*/demo/||g' demo/test/snapshots/new-lint-results.txt", + "test:format": "node demo/test/snapshots/format-config.js", "test:update": "npm run lint:snapshot; ava --update-snapshots" } }