Skip to content

Commit

Permalink
feat(eslint-plugin-experience): remove taiga prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Sep 15, 2023
1 parent cd3b9c1 commit abb9b37
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 81 deletions.
84 changes: 3 additions & 81 deletions projects/eslint-plugin-experience/configs/naming-convention.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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'],
},
],
},
},
],
};
153 changes: 153 additions & 0 deletions projects/eslint-plugin-experience/configs/taiga-naming-convention.js
Original file line number Diff line number Diff line change
@@ -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'],
},
],
},
},
],
};
1 change: 1 addition & 0 deletions projects/eslint-plugin-experience/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit abb9b37

Please sign in to comment.