From abb9b37ecd4522e60fd6f28a3bfe9b870d713e75 Mon Sep 17 00:00:00 2001 From: splincode Date: Fri, 15 Sep 2023 15:32:19 +0400 Subject: [PATCH] feat(eslint-plugin-experience): remove taiga prefix --- .../configs/naming-convention.js | 84 +--------- .../configs/taiga-naming-convention.js | 153 ++++++++++++++++++ projects/eslint-plugin-experience/index.js | 1 + 3 files changed, 157 insertions(+), 81 deletions(-) create mode 100644 projects/eslint-plugin-experience/configs/taiga-naming-convention.js diff --git a/projects/eslint-plugin-experience/configs/naming-convention.js b/projects/eslint-plugin-experience/configs/naming-convention.js index d5becfc1..a4946de5 100644 --- a/projects/eslint-plugin-experience/configs/naming-convention.js +++ b/projects/eslint-plugin-experience/configs/naming-convention.js @@ -15,25 +15,16 @@ module.exports = { selector: 'class', modifiers: ['exported'], format: ['PascalCase'], - prefix: ['Tui'], - }, - { - selector: 'class', - modifiers: ['exported', 'abstract'], - format: ['PascalCase'], - prefix: ['AbstractTui'], }, { selector: 'function', modifiers: ['exported'], - format: ['PascalCase'], - prefix: ['tui'], + format: ['camelCase'], }, { selector: 'interface', modifiers: ['exported'], format: ['PascalCase'], - prefix: ['Tui'], }, { selector: 'variable', @@ -58,13 +49,12 @@ module.exports = { selector: 'class', modifiers: ['abstract'], format: ['PascalCase'], - prefix: ['AbstractTui'], + prefix: ['Abstract'], }, { selector: 'enum', modifiers: ['exported'], format: ['StrictPascalCase'], - prefix: ['Tui'], }, { selector: 'enumMember', @@ -74,80 +64,12 @@ module.exports = { selector: 'classMethod', format: ['strictCamelCase'], filter: { - regex: '(HTML|JSON|CVC|CVCChange|DOM)$', + regex: '(HTML|CSS|TS|JSON|CVC|CVCChange|URI|URL|DOM)$', match: false, }, }, ], }, }, - { - files: [ - '**/projects/*demo/**/*.ts', - '**/scripts/**/*.ts', - '**/schematics/**/*.ts', - '**/apps/**/*.ts', - ], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - rules: { - '@typescript-eslint/naming-convention': [ - 'error', - { - selector: 'typeLike', - format: ['PascalCase', 'UPPER_CASE'], - }, - { - selector: 'class', - modifiers: ['exported'], - format: ['PascalCase'], - }, - { - selector: 'function', - modifiers: ['exported'], - format: ['camelCase'], - }, - { - selector: 'interface', - modifiers: ['exported'], - format: ['PascalCase'], - }, - { - selector: 'variable', - modifiers: ['destructured'], - format: null, - }, - { - selector: 'variable', - format: ['camelCase'], - }, - { - selector: 'variable', - modifiers: ['global'], - format: ['UPPER_CASE', 'camelCase', 'PascalCase'], - }, - { - selector: 'variable', - modifiers: ['exported'], - format: ['UPPER_CASE', 'camelCase', 'PascalCase'], - }, - { - selector: 'class', - modifiers: ['abstract'], - format: ['PascalCase'], - prefix: ['Abstract', 'TuiAbstract', 'Example'], - }, - { - selector: 'enum', - modifiers: ['exported'], - format: ['StrictPascalCase'], - }, - { - selector: 'enumMember', - format: ['PascalCase'], - }, - ], - }, - }, ], }; diff --git a/projects/eslint-plugin-experience/configs/taiga-naming-convention.js b/projects/eslint-plugin-experience/configs/taiga-naming-convention.js new file mode 100644 index 00000000..de44b903 --- /dev/null +++ b/projects/eslint-plugin-experience/configs/taiga-naming-convention.js @@ -0,0 +1,153 @@ +module.exports = { + overrides: [ + { + files: ['*.ts'], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + rules: { + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: 'typeLike', + format: ['PascalCase', 'UPPER_CASE'], + }, + { + selector: 'class', + modifiers: ['exported'], + format: ['PascalCase'], + prefix: ['Tui'], + }, + { + selector: 'class', + modifiers: ['exported', 'abstract'], + format: ['PascalCase'], + prefix: ['AbstractTui'], + }, + { + selector: 'function', + modifiers: ['exported'], + format: ['PascalCase'], + prefix: ['tui'], + }, + { + selector: 'interface', + modifiers: ['exported'], + format: ['PascalCase'], + prefix: ['Tui'], + }, + { + selector: 'variable', + modifiers: ['destructured'], + format: null, + }, + { + selector: 'variable', + format: ['camelCase'], + }, + { + selector: 'variable', + modifiers: ['global'], + format: ['UPPER_CASE', 'camelCase', 'PascalCase'], + }, + { + selector: 'variable', + modifiers: ['exported'], + format: ['UPPER_CASE', 'camelCase', 'PascalCase'], + }, + { + selector: 'class', + modifiers: ['abstract'], + format: ['PascalCase'], + prefix: ['AbstractTui'], + }, + { + selector: 'enum', + modifiers: ['exported'], + format: ['StrictPascalCase'], + prefix: ['Tui'], + }, + { + selector: 'enumMember', + format: ['PascalCase'], + }, + { + selector: 'classMethod', + format: ['strictCamelCase'], + filter: { + regex: '(HTML|CSS|TS|JSON|CVC|CVCChange|URI|URL|DOM)$', + match: false, + }, + }, + ], + }, + }, + { + files: [ + '**/projects/*demo*/**/*.ts', + '**/scripts/**/*.ts', + '**/schematics/**/*.ts', + '**/apps/**/*.ts', + ], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + rules: { + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: 'typeLike', + format: ['PascalCase', 'UPPER_CASE'], + }, + { + selector: 'class', + modifiers: ['exported'], + format: ['PascalCase'], + }, + { + selector: 'function', + modifiers: ['exported'], + format: ['camelCase'], + }, + { + selector: 'interface', + modifiers: ['exported'], + format: ['PascalCase'], + }, + { + selector: 'variable', + modifiers: ['destructured'], + format: null, + }, + { + selector: 'variable', + format: ['camelCase'], + }, + { + selector: 'variable', + modifiers: ['global'], + format: ['UPPER_CASE', 'camelCase', 'PascalCase'], + }, + { + selector: 'variable', + modifiers: ['exported'], + format: ['UPPER_CASE', 'camelCase', 'PascalCase'], + }, + { + selector: 'class', + modifiers: ['abstract'], + format: ['PascalCase'], + prefix: ['Abstract', 'Example'], + }, + { + selector: 'enum', + modifiers: ['exported'], + format: ['StrictPascalCase'], + }, + { + selector: 'enumMember', + format: ['PascalCase'], + }, + ], + }, + }, + ], +}; diff --git a/projects/eslint-plugin-experience/index.js b/projects/eslint-plugin-experience/index.js index 40ba765b..7975b9df 100644 --- a/projects/eslint-plugin-experience/index.js +++ b/projects/eslint-plugin-experience/index.js @@ -9,6 +9,7 @@ module.exports = { typescript: require('./configs/typescript.js'), cypress: require('./configs/cypress.js'), taiga: require('./configs/taiga.js'), + 'taiga-naming-convention': require('./configs/taiga-naming-convention.js'), 'naming-convention': require('./configs/naming-convention.js'), 'no-restricted-syntax': require('./configs/no-restricted-syntax.js'), base: require('./configs/base/index.js'),