Skip to content

Commit

Permalink
[FIX] Correct recommended warning rules (typescript-eslint#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-f1 authored and JamesHenry committed Jan 18, 2019
1 parent 1e12343 commit 36da19b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Expand Up @@ -13,7 +13,7 @@
"camelcase": "off",
"typescript/camelcase": "error",
"typescript/class-name-casing": "error",
"typescript/explicit-function-return-type": "warning",
"typescript/explicit-function-return-type": "warn",
"typescript/explicit-member-accessibility": "error",
"indent": "off",
"typescript/indent": "error",
Expand All @@ -23,7 +23,7 @@
"no-array-constructor": "off",
"typescript/no-array-constructor": "error",
"typescript/no-empty-interface": "error",
"typescript/no-explicit-any": "warning",
"typescript/no-explicit-any": "warn",
"typescript/no-inferrable-types": "error",
"typescript/no-misused-new": "error",
"typescript/no-namespace": "error",
Expand All @@ -32,7 +32,7 @@
"typescript/no-parameter-properties": "error",
"typescript/no-triple-slash-reference": "error",
"no-unused-vars": "off",
"typescript/no-unused-vars": "warning",
"typescript/no-unused-vars": "warn",
"typescript/no-use-before-define": "error",
"typescript/no-var-requires": "error",
"typescript/prefer-interface": "error",
Expand Down
Expand Up @@ -24,7 +24,7 @@ module.exports = {
"Require explicit return types on functions and class methods",
category: "TypeScript",
url: util.metaDocsUrl("explicit-function-return-type"),
recommended: "warning",
recommended: "warn",
},
schema: [
{
Expand Down
Expand Up @@ -19,7 +19,7 @@ module.exports = {
extraDescription: [util.tslintRule("no-any")],
category: "TypeScript",
url: util.metaDocsUrl("no-explicit-any"),
recommended: "warning",
recommended: "warn",
},
schema: [],
},
Expand Down
Expand Up @@ -19,7 +19,7 @@ module.exports = Object.assign({}, baseRule, {
extraDescription: [util.tslintRule("no-unused-variable")],
category: "Variables",
url: util.metaDocsUrl("no-unused-vars"),
recommended: "warning",
recommended: "warn",
},
schema: baseRule.meta.schema,
},
Expand Down
7 changes: 7 additions & 0 deletions packages/eslint-plugin-typescript/tools/update-recommended.js
Expand Up @@ -33,6 +33,13 @@ function generate() {
const ruleName = `typescript/${key}`;
const setting = allRules[key].meta.docs.recommended;

if (!["error", "warn"].includes(setting)) {
console.log(`ERR! Invalid level for rule ${key}: "${setting}"`);
// Don't want to throw an error since ^ explains what happened.
// eslint-disable-next-line no-process-exit
process.exit(1);
}

console.log(ruleName.padEnd(MAX_RULE_NAME_LENGTH), "=", setting);
config[ruleName] = setting;

Expand Down

0 comments on commit 36da19b

Please sign in to comment.