diff --git a/package.json b/package.json index 095c9f86..7211c9bf 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "setup": "yarn install && yarn allow-scripts && yarn patch-package", "lint:eslint": "yarn eslint . --ext ts,js", "lint:config-validation": "node ./scripts/validate-configs.js", - "lint:misc": "prettier '**/*.json' '**/*.md' '!**/CHANGELOG.md' '**/*.yml' --ignore-path .gitignore", + "lint:misc": "prettier '**/*.json' '!**/rules-snapshot.json' '**/*.md' '!**/CHANGELOG.md' '**/*.yml' --ignore-path .gitignore", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:config-validation", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn lint:config-validation --write" }, diff --git a/packages/base/rules-snapshot.json b/packages/base/rules-snapshot.json index 752fcd9c..2924fd56 100644 --- a/packages/base/rules-snapshot.json +++ b/packages/base/rules-snapshot.json @@ -72,6 +72,28 @@ "getter-return": "error", "grouped-accessor-pairs": "error", "guard-for-in": "error", + "id-denylist": [ + "error", + "buf", + "cat", + "err", + "cb", + "cfg", + "hex", + "int", + "msg", + "num", + "opt", + "sig" + ], + "id-length": [ + "error", + { + "min": 2, + "properties": "never", + "exceptionPatterns": ["_", "a", "b", "i", "j", "k"] + } + ], "implicit-arrow-linebreak": "off", "import/default": "error", "import/export": "error", diff --git a/packages/base/src/index.js b/packages/base/src/index.js index 59873131..b802850f 100644 --- a/packages/base/src/index.js +++ b/packages/base/src/index.js @@ -71,6 +71,30 @@ module.exports = { 'func-name-matching': 'error', 'grouped-accessor-pairs': 'error', 'guard-for-in': 'error', + 'id-denylist': [ + // This sets this rule to 'error', the rest are the forbidden IDs. + 'error', + // These are basically all useless contractions. + 'buf', + 'cat', + 'err', + 'cb', + 'cfg', + 'hex', + 'int', + 'msg', + 'num', + 'opt', + 'sig', + ], + 'id-length': [ + 'error', + { + min: 2, + properties: 'never', + exceptionPatterns: ['_', 'a', 'b', 'i', 'j', 'k'], + }, + ], 'lines-between-class-members': 'error', 'max-statements-per-line': [ 'error',