From bfe231b20fd1106e325657210218153fb40103fb Mon Sep 17 00:00:00 2001 From: Sebastian Werner Date: Fri, 3 May 2024 11:28:25 +0200 Subject: [PATCH] feat: added enum to restricted syntax --- config/quality.js | 12 ++++++++++++ generated/rules.js | 11 +++++++++-- generated/rules.md | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/config/quality.js b/config/quality.js index b91adad..4f297b3 100644 --- a/config/quality.js +++ b/config/quality.js @@ -21,6 +21,18 @@ export default { { max: 1000, skipBlankLines: false, skipComments: false } ], + "no-restricted-syntax": [ + "error", + { + selector: "TSEnumDeclaration", + message: "Don't declare enums - use union types instead" + }, + { + selector: "WithStatement", + message: "Don't use with - it's deprecated" + } + ], + // Useful rule for more maintainable code // Block `prop` => `properties` (which is a very common wording in ReactJS) "unicorn/prevent-abbreviations": [ diff --git a/generated/rules.js b/generated/rules.js index e69a677..5288a19 100644 --- a/generated/rules.js +++ b/generated/rules.js @@ -308,8 +308,15 @@ } ], "no-restricted-syntax": [ - "warn", - "WithStatement" + "error", + { + "selector": "TSEnumDeclaration", + "message": "Don't declare enums - use union types instead" + }, + { + "selector": "WithStatement", + "message": "Don't use with - it's deprecated" + } ], "no-return-assign": [ "error", diff --git a/generated/rules.md b/generated/rules.md index 02bcf41..1653009 100644 --- a/generated/rules.md +++ b/generated/rules.md @@ -1478,11 +1478,11 @@ no-restricted-syntax -✓+ - +✓+ +✓+