From 1a6acd8393a27e6459388e7675d488e6a8c21cda Mon Sep 17 00:00:00 2001 From: Pieter Wigboldus Date: Wed, 27 Oct 2021 12:33:55 +0200 Subject: [PATCH] Cleanup and extend the lint list --- bin/cmd.js | 10 ++-- eslintrc.json | 117 ++++++++++++++++++++++++++++++++++------------ options.js | 25 +++++----- package-lock.json | 4 +- package.json | 2 +- 5 files changed, 107 insertions(+), 51 deletions(-) diff --git a/bin/cmd.js b/bin/cmd.js index 11c5f9d..da723de 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -6,11 +6,11 @@ var major = parseInt(match[1], 10) var minor = parseInt(match[2], 10) if (major >= 14 || (major === 14 && minor >= 14)) { - eval('import("standard-engine")').then(function (standardEngine) { - eval('import("../options.js")').then(function (options) { - standardEngine.cli(options.default) - }) + eval('import("standard-engine")').then((standardEngine) => { + eval('import("../options.js")').then((options) => { + standardEngine.cli(options.default) }) + }) } else { - console.error('ponstandard: Node 14.14.0 or greater is required. `pomstandard` did not run.') + console.error('ponstandard: Node 14.14.0 or greater is required. `pomstandard` did not run.') } diff --git a/eslintrc.json b/eslintrc.json index 2a597c5..c2d1d10 100644 --- a/eslintrc.json +++ b/eslintrc.json @@ -1,22 +1,7 @@ { "extends": "standard", "rules": { - "indent": [ - "error", - 4, - { - "ignoredNodes": [ - "TemplateLiteral" - ] - } - ], "block-scoped-var": "error", - "camelcase": [ - "error", - { - "properties": "never" - } - ], "complexity": [ "error", { @@ -45,10 +30,6 @@ "unix" ], "class-methods-use-this": "off", - "comma-style": [ - "warn", - "last" - ], "no-alert": "error", "no-caller": "error", "no-extra-label": "error", @@ -60,9 +41,6 @@ } ], "no-loop-func": "error", - "no-mixed-spaces-and-tabs": [ - "warn" - ], "no-prototype-builtins": "off", "no-restricted-syntax": [ "error", @@ -71,19 +49,15 @@ "WithStatement" ], "no-return-await": "error", - "no-unused-vars": [ - "error", - { - "ignoreRestSiblings": true, - "argsIgnorePattern": "res|next|^err" - } - ], "no-else-return": [ "error", { "allowElseIf": false } ], + "no-multi-assign": [ + "error" + ], "arrow-body-style": [ "error", "as-needed" @@ -92,7 +66,7 @@ "no-param-reassign": [ "error", { - "props": false, + "props": true, "ignorePropertyModificationsFor": [ "acc", "accumulator", @@ -105,12 +79,17 @@ } ], "no-useless-concat": "error", + "no-nested-ternary": "error", "max-len": [ "error", { "code": 120, "comments": 80, - "tabWidth": 4 + "tabWidth": 4, + "ignoreUrls": true, + "ignoreRegExpLiterals": true, + "ignoreStrings": true, + "ignoreTemplateLiterals": true } ], "no-shadow": [ @@ -127,6 +106,16 @@ ] } ], + "no-spaced-func": "error", + "no-underscore-dangle": [ + "error", + { + "allow": [], + "allowAfterThis": false, + "allowAfterSuper": false, + "enforceInMethodNames": true + } + ], "quotes": [ "error", "single", @@ -137,6 +126,42 @@ ], "radix": "error", "import/prefer-default-export": "off", + "import/no-unresolved": [ + "error", + { + "caseSensitive": true + } + ], + "import/named": "error", + "import/no-named-as-default": "error", + "import/no-named-as-default-member": "error", + "import/no-mutable-exports": "error", + "import/order": [ + "error", + { + "groups": [ + [ + "builtin", + "external", + "internal" + ] + ] + } + ], + "import/newline-after-import": "error", + "import/no-self-import": "error", + "import/no-cycle": [ + "error", + { + "maxDepth": "∞" + } + ], + "import/no-useless-path-segments": [ + "error", + { + "commonjs": true + } + ], "vars-on-top": "error", "for-direction": "error", "getter-return": [ @@ -148,6 +173,7 @@ "no-await-in-loop": "error", "no-inner-declarations": "error", "no-var": "error", + "no-lonely-if": "error", "prefer-arrow-callback": [ "error", { @@ -173,6 +199,35 @@ ], "prefer-rest-params": "error", "prefer-spread": "error", + "prefer-template": "error", + "require-yield": "error", + "function-paren-newline": [ + "error", + "consistent" + ], + "implicit-arrow-linebreak": [ + "error", + "beside" + ], + "newline-per-chained-call": [ + "error", + { + "ignoreChainWithDepth": 4 + } + ], + "nonblock-statement-body-position": [ + "error", + "beside", + { + "overrides": {} + } + ], + "operator-assignment": [ + "error", + "always" + ], + "prefer-object-spread": "error", + "no-delete-var": "error", "valid-jsdoc": [ "error", { diff --git a/options.js b/options.js index e0861a7..13df8ee 100644 --- a/options.js +++ b/options.js @@ -9,16 +9,17 @@ const pkg = JSON.parse(readFileSync(pkgUrl, 'utf-8')) const configFile = fileURLToPath(new URL('eslintrc.json', import.meta.url)) const baseConfig = JSON.parse(readFileSync(stdOpts.eslintConfig.configFile, 'utf-8')) -export default Object.assign({}, stdOpts, { - bugs: pkg.bugs.url, - cmd: 'ponstandard', - eslint, - eslintConfig: { - baseConfig, - configFile, - useEslintrc: true - }, - homepage: pkg.homepage, - tagline: 'Use JavaScript Standard Style (tweaked by PON)', - version: `${pkg.version} (standard ${stdVersion})` +export default ({ + ...stdOpts, + bugs: pkg.bugs.url, + cmd: 'ponstandard', + eslint, + eslintConfig: { + baseConfig, + configFile, + useEslintrc: true + }, + homepage: pkg.homepage, + tagline: 'Use JavaScript Standard Style (tweaked by PON)', + version: `${pkg.version} (standard ${stdVersion})` }) diff --git a/package-lock.json b/package-lock.json index d1054dc..1db27b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ponbike/ponstandard", - "version": "0.1.0", + "version": "0.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@ponbike/ponstandard", - "version": "0.1.0", + "version": "0.2.0", "license": "GPL-3", "dependencies": { "eslint": "^7.32.0", diff --git a/package.json b/package.json index f044743..fbbcb20 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@ponbike/ponstandard", "description": "JavaScript Standard Style with custom PON tweaks", - "version": "0.1.0", + "version": "0.2.0", "author": { "name": "Pieter Wigboldus", "email": "pieter.wigboldus@pon.com",