|
1 | | -/* |
2 | | -👋 Hi! This file was autogenerated by tslint-to-eslint-config. |
3 | | -https://github.com/typescript-eslint/tslint-to-eslint-config |
| 1 | +module.exports = { |
| 2 | + root: true, |
4 | 3 |
|
5 | | -It represents the closest reasonable ESLint configuration to this |
6 | | -project's original TSLint configuration. |
| 4 | + // Para ignorar algo global, ponerlo acá |
| 5 | + ignorePatterns: [ |
| 6 | + "dist/**", |
| 7 | + "**/*.min.*" |
| 8 | + ], |
7 | 9 |
|
8 | | -We recommend eventually switching this configuration to extend from |
9 | | -the recommended rulesets in typescript-eslint. |
10 | | -https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md |
| 10 | + // Overrides por tipo de archivo |
| 11 | + overrides: [ |
| 12 | + // ==== Archivos TypeScript ==== |
| 13 | + { |
| 14 | + files: ["*.ts"], |
| 15 | + parser: "@typescript-eslint/parser", |
| 16 | + parserOptions: { |
| 17 | + project: ["tsconfig.json"], |
| 18 | + tsconfigRootDir: __dirname, |
| 19 | + sourceType: "module" |
| 20 | + }, |
| 21 | + plugins: [ |
| 22 | + "@angular-eslint", |
| 23 | + "import", |
| 24 | + "prefer-arrow", |
| 25 | + "@typescript-eslint" |
| 26 | + ], |
| 27 | + // Opcionalmente se puede añadir `extends: ["plugin:@angular-eslint/recommended"]` para setear defaults |
| 28 | + rules: { |
| 29 | + // --- reglas TS/Angular --- |
| 30 | + "@typescript-eslint/no-explicit-any": "off", |
| 31 | + "@typescript-eslint/indent": ["error", 4, { |
| 32 | + ObjectExpression: "first", |
| 33 | + FunctionDeclaration: { parameters: "first" }, |
| 34 | + FunctionExpression: { parameters: "first" }, |
| 35 | + SwitchCase: 1, |
| 36 | + ArrayExpression: "first" |
| 37 | + }], |
| 38 | + "@typescript-eslint/no-empty-function": "off", |
| 39 | + "@typescript-eslint/no-empty-interface": "error", |
| 40 | + "@typescript-eslint/no-inferrable-types": ["error", { ignoreParameters: true }], |
| 41 | + "@typescript-eslint/prefer-function-type": "error", |
| 42 | + "@typescript-eslint/unified-signatures": "error", |
| 43 | + "@typescript-eslint/member-delimiter-style": ["error", { |
| 44 | + multiline: { delimiter: "semi", requireLast: true }, |
| 45 | + singleline: { delimiter: "semi", requireLast: false } |
| 46 | + }], |
| 47 | + "@typescript-eslint/semi": ["error", "always"], |
| 48 | + "@typescript-eslint/type-annotation-spacing": "error", |
| 49 | + "@typescript-eslint/quotes": ["error", "single"], |
11 | 50 |
|
12 | | -Happy linting! 💖 |
13 | | -*/ |
14 | | -module.exports = { |
15 | | - "env": { |
16 | | - "browser": true, |
17 | | - "es6": true, |
18 | | - "node": true |
19 | | - }, |
20 | | - "parser": "@typescript-eslint/parser", |
21 | | - "parserOptions": { |
22 | | - "project": "tsconfig.json", |
23 | | - "sourceType": "module", |
24 | | - "extraFileExtensions": [".html"] |
25 | | - }, |
26 | | - "plugins": [ |
27 | | - "@angular-eslint/eslint-plugin", |
28 | | - "eslint-plugin-import", |
29 | | - "eslint-plugin-prefer-arrow", |
30 | | - "@typescript-eslint" |
31 | | - ], |
32 | | - "root": true, |
33 | | - "ignorePatterns": ["src/demo/**/*.html"], |
34 | | - "rules": { |
35 | | - "@angular-eslint/component-class-suffix": "error", |
36 | | - "@angular-eslint/component-selector": [ |
37 | | - "error", |
38 | | - { |
39 | | - "type": "element", |
40 | | - // "prefix": "plex", |
41 | | - "style": "kebab-case" |
42 | | - } |
43 | | - ], |
44 | | - // "@angular-eslint/directive-class-suffix": "error", |
45 | | - "@angular-eslint/directive-selector": [ |
46 | | - "error", |
47 | | - { |
48 | | - "type": "attribute", |
49 | | - // "prefix": "plex", |
50 | | - "style": "camelCase" |
51 | | - } |
52 | | - ], |
53 | | - "@angular-eslint/no-input-rename": "error", |
54 | | - "@angular-eslint/no-output-rename": "error", |
55 | | - "@angular-eslint/use-pipe-transform-interface": "error", |
56 | | - "@typescript-eslint/consistent-type-definitions": "error", |
57 | | - "@typescript-eslint/dot-notation": "off", |
58 | | - "@typescript-eslint/explicit-member-accessibility": [ |
59 | | - "off", |
60 | | - { |
61 | | - "accessibility": "explicit" |
62 | | - } |
63 | | - ], |
64 | | - // "@typescript-eslint/indent": [ |
65 | | - // "error", |
66 | | - // 4, |
67 | | - // { |
68 | | - // "ObjectExpression": "first", |
69 | | - // "FunctionDeclaration": { |
70 | | - // "parameters": "first" |
71 | | - // }, |
72 | | - // "FunctionExpression": { |
73 | | - // "parameters": "first" |
74 | | - // } |
75 | | - // } |
76 | | - // ], |
77 | | - // "@typescript-eslint/member-delimiter-style": [ |
78 | | - // "error", |
79 | | - // { |
80 | | - // "multiline": { |
81 | | - // "delimiter": "semi", |
82 | | - // "requireLast": true |
83 | | - // }, |
84 | | - // "singleline": { |
85 | | - // "delimiter": "semi", |
86 | | - // "requireLast": false |
87 | | - // } |
88 | | - // } |
89 | | - // ], |
90 | | - // "@typescript-eslint/naming-convention": [ |
91 | | - // "error", |
92 | | - // { |
93 | | - // "selector": "variable", |
94 | | - // "format": [ |
95 | | - // "camelCase", |
96 | | - // "UPPER_CASE" |
97 | | - // ], |
98 | | - // "leadingUnderscore": "forbid", |
99 | | - // "trailingUnderscore": "forbid" |
100 | | - // } |
101 | | - // ], |
102 | | - "@typescript-eslint/no-empty-function": "off", |
103 | | - "@typescript-eslint/no-empty-interface": "error", |
104 | | - "@typescript-eslint/no-inferrable-types": [ |
105 | | - "error", |
106 | | - { |
107 | | - "ignoreParameters": true |
108 | | - } |
109 | | - ], |
110 | | - // "@typescript-eslint/no-shadow": [ |
111 | | - // "error", |
112 | | - // { |
113 | | - // "hoist": "all" |
114 | | - // } |
115 | | - // ], |
116 | | - // "@typescript-eslint/no-unused-expressions": "error", |
117 | | - "@typescript-eslint/prefer-function-type": "error", |
118 | | - // "@typescript-eslint/quotes": [ |
119 | | - // "error", |
120 | | - // "single" |
121 | | - // ], |
122 | | - // "@typescript-eslint/semi": [ |
123 | | - // "error", |
124 | | - // "always" |
125 | | - // ], |
126 | | - // "@typescript-eslint/type-annotation-spacing": "error", |
127 | | - "@typescript-eslint/unified-signatures": "error", |
128 | | - // "brace-style": [ |
129 | | - // "error", |
130 | | - // "1tbs" |
131 | | - // ], |
132 | | - // "curly": "error", |
133 | | - "dot-notation": "off", |
134 | | - // "eol-last": "error", |
135 | | - // "eqeqeq": [ |
136 | | - // "error", |
137 | | - // "smart" |
138 | | - // ], |
139 | | - "guard-for-in": "off", |
140 | | - "id-denylist": "off", |
141 | | - "id-match": "off", |
142 | | - "import/no-extraneous-dependencies": [ |
143 | | - "error", |
144 | | - { |
145 | | - "devDependencies": false |
| 51 | + "@angular-eslint/component-class-suffix": ["error", { suffixes: ["Component"] }], |
| 52 | + "@angular-eslint/directive-class-suffix": ["error", { suffixes: ["Directive"] }], |
| 53 | + "@angular-eslint/no-host-metadata-property": "error", |
| 54 | + "@angular-eslint/no-inputs-metadata-property": "error", |
| 55 | + "@angular-eslint/no-outputs-metadata-property": "error", |
| 56 | + "@angular-eslint/use-lifecycle-interface": "warn", |
| 57 | + "@angular-eslint/use-pipe-transform-interface": "warn", |
| 58 | + "@angular-eslint/no-outputs-metadata-property": "error", |
| 59 | + |
| 60 | + "@typescript-eslint/consistent-type-definitions": "error", |
| 61 | + "@typescript-eslint/dot-notation": "off", |
| 62 | + "@typescript-eslint/explicit-member-accessibility": ["off", { accessibility: "explicit" }], |
| 63 | + |
| 64 | + "@angular-eslint/component-selector": ["off", { type: "element", prefix: ["app", "mpi"], style: "kebab-case" }], |
| 65 | + "@angular-eslint/directive-selector": ["off", { type: "attribute", prefix: ["app", "mpi", "tm"], style: "camelCase" }], |
| 66 | + |
| 67 | + // Reglas JS/TS base |
| 68 | + "indent": "off", |
| 69 | + "keyword-spacing": ["error", { after: true, before: true }], |
| 70 | + "space-before-blocks": ["error", { functions: "always", keywords: "always", classes: "always" }], |
| 71 | + "brace-style": ["error", "1tbs", { allowSingleLine: true }], |
| 72 | + "object-curly-spacing": ["error", "always"], |
| 73 | + "curly": "error", |
| 74 | + "comma-spacing": ["error", { before: false, after: true }], |
| 75 | + "dot-notation": "off", |
| 76 | + "eol-last": "error", |
| 77 | + "eqeqeq": ["error", "smart"], |
| 78 | + "no-bitwise": "error", |
| 79 | + "no-caller": "error", |
| 80 | + "no-console": ["error", { allow: ["debug", "info", "warn", "error", "trace", "time", "timeEnd"] }], |
| 81 | + "no-debugger": "error", |
| 82 | + "no-empty": "off", |
| 83 | + "no-empty-function": "off", |
| 84 | + "no-eval": "error", |
| 85 | + "no-fallthrough": "error", |
| 86 | + "no-new-wrappers": "error", |
| 87 | + "no-redeclare": "error", |
| 88 | + "no-restricted-imports": "error", |
| 89 | + "no-throw-literal": "error", |
| 90 | + "no-trailing-spaces": "error", |
| 91 | + "no-underscore-dangle": "off", |
| 92 | + "no-unused-labels": "error", |
| 93 | + "no-var": "error", |
| 94 | + "prefer-const": ["error", { destructuring: "any", ignoreReadBeforeAssign: false }], |
| 95 | + "prefer-arrow-callback": ["error", { allowUnboundThis: true, allowNamedFunctions: true }], |
| 96 | + "space-before-function-paren": ["error", { anonymous: "always", named: "never", asyncArrow: "always" }], |
| 97 | + "quotes": ["error", "single"], |
| 98 | + "radix": "error", |
| 99 | + "semi": "error", |
| 100 | + "spaced-comment": ["error", "always", { markers: ["/"] }], |
| 101 | + "array-bracket-spacing": ["error", "never", { singleValue: false, objectsInArrays: false, arraysInArrays: false }], |
| 102 | + "no-irregular-whitespace": ["error", { skipComments: true }], |
| 103 | + "no-multi-spaces": "error" |
146 | 104 | } |
147 | | - ], |
148 | | - "indent": "off", |
149 | | - "max-len": [ |
150 | | - "off", |
151 | | - { |
152 | | - "code": 140 |
| 105 | + }, |
| 106 | + |
| 107 | + // ==== Tests (*.spec.ts) ==== |
| 108 | + { |
| 109 | + files: ["**/*.spec.ts"], |
| 110 | + parser: "@typescript-eslint/parser", |
| 111 | + parserOptions: { |
| 112 | + project: [ |
| 113 | + "projects/plex-demo/tsconfig.spec.json", // tsconfig de la demo para tests |
| 114 | + "tsconfig.json" // por si importa algo comun |
| 115 | + ], |
| 116 | + tsconfigRootDir: __dirname, |
| 117 | + sourceType: "module" |
| 118 | + }, |
| 119 | + env: { |
| 120 | + jasmine: true, // habilita describe/it/expect como globales |
| 121 | + node: true |
| 122 | + }, |
| 123 | + rules: { |
| 124 | + // Se puede desactivar reglas solo para tests si hace falta |
| 125 | + // "@typescript-eslint/no-explicit-any": "off" |
153 | 126 | } |
154 | | - ], |
155 | | - "no-bitwise": "error", |
156 | | - "no-caller": "error", |
157 | | - // "no-console": "error", |
158 | | - "no-constant-condition": "error", |
159 | | - "no-debugger": "error", |
160 | | - "no-empty": "off", |
161 | | - "no-empty-function": "off", |
162 | | - "no-eval": "error", |
163 | | - "no-fallthrough": "error", |
164 | | - "no-multiple-empty-lines": [ |
165 | | - "error", |
166 | | - { |
167 | | - "max": 2 |
| 127 | + }, |
| 128 | + |
| 129 | + // ==== Plantillas Angular (HTML) ==== |
| 130 | + { |
| 131 | + files: ["*.html"], |
| 132 | + parser: "@angular-eslint/template-parser", |
| 133 | + plugins: ["@angular-eslint/template"], |
| 134 | + extends: ["plugin:@angular-eslint/template/recommended"], |
| 135 | + rules: { |
| 136 | + // Rglas de template (ej.: desactivar alguna) |
| 137 | + // "@angular-eslint/template/eqeqeq": "off" |
168 | 138 | } |
169 | | - ], |
170 | | - "no-new-wrappers": "error", |
171 | | - // "no-redeclare": "error", |
172 | | - "no-restricted-imports": "error", |
173 | | - "no-shadow": "off", |
174 | | - "no-throw-literal": "error", |
175 | | - "no-trailing-spaces": "error", |
176 | | - "no-underscore-dangle": "off", |
177 | | - "no-unused-expressions": "off", |
178 | | - "no-unused-labels": "error", |
179 | | - // "no-var": "error", |
180 | | - // "object-shorthand": "error", |
181 | | - // "prefer-arrow/prefer-arrow-functions": [ |
182 | | - // "error", |
183 | | - // { |
184 | | - // "allowStandaloneDeclarations": true |
185 | | - // } |
186 | | - // ], |
187 | | - "prefer-const": "error", |
188 | | - "prefer-object-spread": "error", |
189 | | - // "quote-props": [ |
190 | | - // "error", |
191 | | - // "as-needed" |
192 | | - // ], |
193 | | - "quotes": "off", |
194 | | - // "radix": "error", |
195 | | - "semi": "off", |
196 | | - // "space-before-function-paren": [ |
197 | | - // "error", |
198 | | - // { |
199 | | - // "anonymous": "always", |
200 | | - // "named": "never", |
201 | | - // "asyncArrow": "always" |
202 | | - // } |
203 | | - // ], |
204 | | - // "spaced-comment": [ |
205 | | - // "error", |
206 | | - // "always", |
207 | | - // { |
208 | | - // "markers": [ |
209 | | - // "/" |
210 | | - // ] |
211 | | - // } |
212 | | - // ], |
213 | | - } |
| 139 | + } |
| 140 | + ] |
214 | 141 | }; |
| 142 | + |
0 commit comments