From 28c11ffce18228be3bf36f1d6a2a1fcd819e28c3 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Tue, 15 Aug 2023 00:28:17 +0200 Subject: [PATCH] fix: more tweaks to base and typescript config --- base.cjs | 107 +++++++++++++++++++++++++++++++++++++++++++++---- typescript.cjs | 8 ++++ 2 files changed, 108 insertions(+), 7 deletions(-) diff --git a/base.cjs b/base.cjs index 03dcb130..580a8f1d 100644 --- a/base.cjs +++ b/base.cjs @@ -14,6 +14,105 @@ module.exports = { rules: { 'no-use-extend-native/no-use-extend-native': 'error', + 'unicorn/prevent-abbreviations': [ + 'error', + { + checkFilenames: false, + checkDefaultAndNamespaceImports: false, + checkShorthandImports: false, + extendDefaultReplacements: false, + replacements: { + whitelist: { + include: true, + }, + blacklist: { + exclude: true, + }, + master: { + main: true, + }, + slave: { + secondary: true, + }, + props: { + properties: false, + }, + + // Not part of `eslint-plugin-unicorn` + application: { + app: true, + }, + applications: { + apps: true, + }, + + // Part of `eslint-plugin-unicorn` + arr: { + array: true, + }, + e: { + error: true, + event: true, + }, + el: { + element: true, + }, + elem: { + element: true, + }, + len: { + length: true, + }, + msg: { + message: true, + }, + num: { + number: true, + }, + obj: { + object: true, + }, + opts: { + options: true, + }, + param: { + parameter: true, + }, + params: { + parameters: true, + }, + prev: { + previous: true, + }, + req: { + request: true, + }, + res: { + response: true, + result: true, + }, + ret: { + returnValue: true, + }, + str: { + string: true, + }, + temp: { + temporary: true, + }, + tmp: { + temporary: true, + }, + val: { + value: true, + }, + err: { + error: true, + }, + }, + }, + ], + 'unicorn/better-regex': [ 'error', { @@ -31,13 +130,7 @@ module.exports = { 'import/default': 'error', 'import/export': 'error', - 'import/extensions': [ - 'error', - 'always', - { - ignorePackages: true, - }, - ], + 'import/extensions': ['error', 'ignorePackages'], 'import/first': 'error', 'import/namespace': [ diff --git a/typescript.cjs b/typescript.cjs index af5eeeea..19972c6f 100644 --- a/typescript.cjs +++ b/typescript.cjs @@ -40,6 +40,14 @@ module.exports = { format: ['camelCase', 'PascalCase', 'UPPER_CASE'], }, ], + 'import/extensions': [ + 'error', + 'ignorePackages', + { + ts: 'never', + tsx: 'never', + }, + ], // Deviation from xo's config - we allow usage of null and empty array types. '@typescript-eslint/ban-types': [ 'error',