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'),