diff --git a/projects/eslint-plugin-experience/README.md b/projects/eslint-plugin-experience/README.md index 62aaa6b9..7a2a651e 100644 --- a/projects/eslint-plugin-experience/README.md +++ b/projects/eslint-plugin-experience/README.md @@ -8,3 +8,67 @@ module.exports = { extends: ['plugin:@taiga-ui/experience/all'], }; ``` + +or just + +`.eslintrc.js` + +```js +module.exports = { + root: true, + plugins: ['@typescript-eslint', '@taiga-ui/experience'], + rules: { + '@taiga-ui/experience/injection-token-description': 'error', + '@taiga-ui/experience/prefer-inject-decorator': 'error', + '@taiga-ui/experience/prefer-self-destroy-service': 'error', + '@taiga-ui/experience/no-typeof': 'error', + '@taiga-ui/experience/no-private-esnext-fields': 'error', + '@taiga-ui/experience/no-deep-imports': [ + 'error', + { + currentProject: '(?<=projects/)([-\\w]+)', + ignoreImports: ['\\?raw', '@taiga-ui/testing/cypress', '@taiga-ui/testing/setup-jest'], + }, + ], + '@taiga-ui/experience/strict-tui-doc-example': 'error', + '@taiga-ui/experience/no-assert-without-ng-dev-mode': 'error', + '@taiga-ui/experience/decorator-key-sort': [ + 'error', + { + Component: [ + 'moduleId', + 'standalone', + 'signal', + 'selector', + 'template', + 'templateUrl', + 'styleUrls', + 'styles', + 'encapsulation', + 'changeDetection', + 'providers', + 'viewProviders', + 'animations', + 'entryComponents', + 'preserveWhitespaces', + 'interpolation', + ], + NgModule: [ + 'id', + 'jit', + 'imports', + 'declarations', + 'providers', + 'exports', + 'entryComponents', + 'bootstrap', + 'schemas', + ], + Directive: ['selector', 'inputs', 'outputs', 'providers', 'exportAs', 'queries', 'host', 'jit'], + Injectable: ['providedIn'], + Pipe: ['name', 'pure'], + }, + ], + }, +}; +``` diff --git a/projects/eslint-plugin-experience/configs/taiga.js b/projects/eslint-plugin-experience/configs/taiga.js index cb8f60f8..9dd4a1f4 100644 --- a/projects/eslint-plugin-experience/configs/taiga.js +++ b/projects/eslint-plugin-experience/configs/taiga.js @@ -26,49 +26,47 @@ module.exports = { '@taiga-ui/experience/decorator-key-sort': [ 'error', { - decorators: { - Component: [ - 'moduleId', - 'standalone', - 'signal', - 'selector', - 'template', - 'templateUrl', - 'styleUrls', - 'styles', - 'encapsulation', - 'changeDetection', - 'providers', - 'viewProviders', - 'animations', - 'entryComponents', - 'preserveWhitespaces', - 'interpolation', - ], - NgModule: [ - 'id', - 'jit', - 'imports', - 'declarations', - 'providers', - 'exports', - 'entryComponents', - 'bootstrap', - 'schemas', - ], - Directive: [ - 'selector', - 'inputs', - 'outputs', - 'providers', - 'exportAs', - 'queries', - 'host', - 'jit', - ], - Injectable: ['providedIn'], - Pipe: ['name', 'pure'], - }, + Component: [ + 'moduleId', + 'standalone', + 'signal', + 'selector', + 'template', + 'templateUrl', + 'styleUrls', + 'styles', + 'encapsulation', + 'changeDetection', + 'providers', + 'viewProviders', + 'animations', + 'entryComponents', + 'preserveWhitespaces', + 'interpolation', + ], + NgModule: [ + 'id', + 'jit', + 'imports', + 'declarations', + 'providers', + 'exports', + 'entryComponents', + 'bootstrap', + 'schemas', + ], + Directive: [ + 'selector', + 'inputs', + 'outputs', + 'providers', + 'exportAs', + 'queries', + 'host', + 'jit', + ], + Injectable: ['providedIn'], + Pipe: ['name', 'pure'], }, ], }, diff --git a/projects/eslint-plugin-experience/rules/decorator-key-sort.js b/projects/eslint-plugin-experience/rules/decorator-key-sort.js index ebaf486d..be92be81 100644 --- a/projects/eslint-plugin-experience/rules/decorator-key-sort.js +++ b/projects/eslint-plugin-experience/rules/decorator-key-sort.js @@ -1,7 +1,3 @@ -const DEFAULT_OPTIONS = { - decorators: {}, -}; - /** * @type {import(`eslint`).Rule.RuleModule} */ @@ -12,24 +8,13 @@ module.exports = { schema: [ { type: `object`, - properties: { - decorators: { - type: `object`, - description: `Decorators names and his keys order`, - properties: { - additionalProperties: true, - }, - }, - }, - additionalProperties: false, + description: `Decorators names and his keys order`, + additionalProperties: true, }, ], }, create(context) { - const {decorators: ORDER} = { - ...DEFAULT_OPTIONS, - ...(context.options[0] || {}), - }; + const ORDER = context.options[0] || {}; return { ClassDeclaration(node) {