Skip to content

Commit b4aea8f

Browse files
Hristo HristovHristo Hristov
authored andcommitted
fix(cli): fix configurations for es lint
1 parent a0da86f commit b4aea8f

File tree

7 files changed

+64
-162
lines changed

7 files changed

+64
-162
lines changed

eslint.config.mjs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,29 @@ import typescriptParser from '@typescript-eslint/parser';
55

66
export default [
77
{
8-
files: ['**/*.ts', '**/*.tsx'],
9-
languageOptions: {
10-
parser: typescriptParser,
11-
parserOptions: {
12-
project: '**/tsconfig.json',
13-
sourceType: 'module',
14-
},
8+
files: ['**/*.ts', '**/*.tsx'],
9+
languageOptions: {
10+
globals: {
11+
browser: true,
12+
es6: true,
13+
node: true
14+
},
15+
//"extends": [
16+
// TODO: consider extending the recommended by ts rules and overriding them where necessary
17+
// 'eslint:recommended',
18+
// 'plugin:@typescript-eslint/recommended'
19+
//],
20+
parser: typescriptParser,
21+
parserOptions: {
22+
project: '**/tsconfig.json',
23+
sourceType: 'module',
24+
},
1525
},
1626
plugins: {
1727
'eslint-plugin-import': eslintPluginImport,
1828
'eslint-plugin-unicorn': eslintPluginUnicorn,
1929
'eslint-plugin-prefer-arrow': eslintPluginPreferArrow,
20-
'@typescript-eslint/parser': typescriptParser,
30+
// "@typescript-eslint" - install it if we extend the recommended ts rules
2131
},
2232
rules: {
2333
'complexity': 'off',

packages/cli/templates/react/igr-ts/projects/_base/files/eslint.config.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import js from '@eslint/js';
2-
import parser from '@typescript-eslint/parser';
2+
import typescriptParser from '@typescript-eslint/parser';
33
import reactRefresh from 'eslint-plugin-react-refresh';
44
import { FlatCompat } from "@eslint/eslintrc";
55

@@ -10,12 +10,13 @@ const compat = new FlatCompat({
1010
export default [
1111
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended'),
1212
{
13+
files: ['**/*.ts', '**/*.tsx'],
1314
languageOptions: {
1415
globals: {
1516
browser: true,
1617
es2020: true,
1718
},
18-
parser: parser,
19+
parser: typescriptParser,
1920
parserOptions: {
2021
ecmaVersion: 'latest',
2122
sourceType: 'module',

packages/cli/templates/webcomponents/igc-ts/projects/_base/files/eslint.config.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import js from '@eslint/js';
2-
import parser from '@typescript-eslint/parser';
2+
import typescriptParser from '@typescript-eslint/parser';
33
import tseslint from '@typescript-eslint/eslint-plugin';
44
import { FlatCompat } from "@eslint/eslintrc";
55

@@ -10,13 +10,14 @@ const compat = new FlatCompat({
1010
export default [
1111
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended'),
1212
{
13+
files: ['**/*.ts', '**/*.tsx'],
1314
languageOptions: {
1415
globals: {
1516
browser: true,
1617
es2021: true,
1718
jasmine: true,
1819
},
19-
parser: parser,
20+
parser: typescriptParser,
2021
parserOptions: {
2122
ecmaVersion: 12,
2223
sourceType: 'module',
Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,35 @@
1-
import angularEslint from "@angular-eslint/eslint-plugin";
2-
import angularEslintTemplate from "@angular-eslint/eslint-plugin-template";
3-
import typescriptParser from "@typescript-eslint/parser";
1+
import { FlatCompat } from '@eslint/eslintrc';
2+
3+
const compat = new FlatCompat();
44

55
export default [
6+
...compat.extends('plugin:@angular-eslint/recommended', 'plugin:@angular-eslint/template/process-inline-templates'),
67
{
7-
files: ["**/*.ts"],
8+
files: ['**/*.ts', '**/*.tsx'],
89
languageOptions: {
9-
parser: typescriptParser,
1010
parserOptions: {
11-
project: "tsconfig.json",
11+
project: ['tsconfig.json'],
1212
createDefaultProgram: true,
1313
},
1414
},
15-
plugins: {
16-
"@angular-eslint": angularEslint,
17-
},
18-
extends: [
19-
"plugin:@angular-eslint/recommended",
20-
"plugin:@angular-eslint/template/process-inline-templates",
21-
],
2215
rules: {
23-
"@angular-eslint/directive-selector": [
24-
"error",
25-
{
26-
type: "attribute",
27-
prefix: "app",
28-
style: "camelCase",
29-
},
16+
'@angular-eslint/directive-selector': [
17+
'error',
18+
{ type: 'attribute', prefix: 'app', style: 'camelCase' },
3019
],
31-
"@angular-eslint/component-selector": [
32-
"error",
33-
{
34-
type: "element",
35-
prefix: "app",
36-
style: "kebab-case",
37-
},
20+
'@angular-eslint/component-selector': [
21+
'error',
22+
{ type: 'element', prefix: 'app', style: 'kebab-case' },
3823
],
39-
"@angular-eslint/prefer-standalone": "off",
24+
'@angular-eslint/prefer-standalone': 'off'
4025
},
4126
},
27+
...compat.extends('plugin:@angular-eslint/template/recommended'),
4228
{
43-
files: ["**/*.html"],
44-
plugins: {
45-
"@angular-eslint/template": angularEslintTemplate,
46-
},
47-
extends: ["plugin:@angular-eslint/template/recommended"],
29+
files: ['**/*.html'],
4830
rules: {},
4931
},
5032
{
51-
ignores: ["projects/**/*"],
33+
ignores: ['projects/**/*']
5234
},
5335
];

packages/igx-templates/igx-ts-legacy/projects/_base/files/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"@typescript-eslint/parser": "8.21.0",
4747
"eslint": "~9.20.0",
4848
"eslint-plugin-import": "^2.29.1",
49-
"eslint-plugin-prefer-arrow": "^1.2.3",
50-
"eslint-plugin-unicorn": "^52.0.0",
49+
"eslint-plugin-prefer-arrow": "^1.2.3",
50+
"eslint-plugin-unicorn": "^52.0.0",
5151
"igniteui-cli": "~<%=cliVersion%>",
5252
"jasmine-core": "~5.1.0",
5353
"karma": "~6.4.0",
Lines changed: 20 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,34 @@
1-
import eslintPluginImport from "eslint-plugin-import";
2-
import eslintPluginUnicorn from "eslint-plugin-unicorn";
3-
import eslintPluginPreferArrow from "eslint-plugin-prefer-arrow";
4-
import typescriptParser from "@typescript-eslint/parser";
1+
import { FlatCompat } from '@eslint/eslintrc';
2+
3+
const compat = new FlatCompat();
54

65
export default [
6+
...compat.extends('plugin:@angular-eslint/recommended', 'plugin:@angular-eslint/template/process-inline-templates'),
77
{
8-
files: ["**/*.ts", "**/*.tsx"],
8+
files: ['**/*.ts', '**/*.tsx'],
99
languageOptions: {
10-
parser: typescriptParser,
1110
parserOptions: {
12-
project: "**/tsconfig.json",
13-
sourceType: "module",
11+
project: ['tsconfig.json'],
12+
createDefaultProgram: true,
1413
},
1514
},
16-
plugins: {
17-
import: eslintPluginImport,
18-
unicorn: eslintPluginUnicorn,
19-
"prefer-arrow": eslintPluginPreferArrow,
20-
},
2115
rules: {
22-
complexity: "off",
23-
"import/no-extraneous-dependencies": "warn",
24-
"import/no-internal-modules": "warn",
25-
"import/order": [
26-
"off",
27-
{
28-
alphabetize: {
29-
caseInsensitive: true,
30-
order: "asc",
31-
},
32-
"newlines-between": "ignore",
33-
groups: [
34-
["builtin", "external", "internal", "unknown", "object", "type"],
35-
"parent",
36-
["sibling", "index"],
37-
],
38-
distinctGroup: false,
39-
pathGroupsExcludedImportTypes: [],
40-
pathGroups: [
41-
{
42-
pattern: "./",
43-
patternOptions: { nocomment: true, dot: true },
44-
group: "sibling",
45-
position: "before",
46-
},
47-
{
48-
pattern: ".",
49-
patternOptions: { nocomment: true, dot: true },
50-
group: "sibling",
51-
position: "before",
52-
},
53-
{
54-
pattern: "..",
55-
patternOptions: { nocomment: true, dot: true },
56-
group: "parent",
57-
position: "before",
58-
},
59-
{
60-
pattern: "../",
61-
patternOptions: { nocomment: true, dot: true },
62-
group: "parent",
63-
position: "before",
64-
},
65-
],
66-
},
16+
'@angular-eslint/directive-selector': [
17+
'error',
18+
{ type: 'attribute', prefix: 'app', style: 'camelCase' },
6719
],
68-
"no-constant-condition": "warn",
69-
"no-case-declarations": "off",
70-
"no-extra-boolean-cast": "warn",
71-
"no-unused-vars": "off",
72-
"no-unexpected-multiline": "off",
73-
"no-useless-escape": "off",
74-
"new-parens": "error",
75-
"no-bitwise": "off",
76-
"no-caller": "error",
77-
"no-cond-assign": "error",
78-
"no-console": "off",
79-
"no-debugger": "error",
80-
"no-duplicate-case": "error",
81-
"no-duplicate-imports": "error",
82-
"no-empty": "off",
83-
"no-empty-function": "off",
84-
"no-eval": "error",
85-
"no-extra-bind": "error",
86-
"no-fallthrough": "off",
87-
"no-invalid-this": "off",
88-
"no-new-func": "error",
89-
"no-new-wrappers": "error",
90-
"no-redeclare": "error",
91-
"no-return-await": "error",
92-
"no-sequences": "error",
93-
"no-shadow": "off",
94-
"no-sparse-arrays": "error",
95-
"no-template-curly-in-string": "error",
96-
"no-throw-literal": "error",
97-
"no-trailing-spaces": "error",
98-
"no-undef-init": "error",
99-
"no-underscore-dangle": "off",
100-
"no-unsafe-finally": "error",
101-
"no-unused-expressions": "off",
102-
"no-unused-labels": "error",
103-
"no-use-before-define": "off",
104-
"no-var": "error",
105-
"object-shorthand": "warn",
106-
"one-var": ["error", "never"],
107-
"prefer-arrow/prefer-arrow-functions": "off",
108-
"prefer-const": "warn",
109-
"prefer-object-spread": "off",
110-
radix: "error",
111-
"space-in-parens": ["error", "never"],
112-
"unicorn/prefer-ternary": "off",
113-
"use-isnan": "error",
114-
"valid-typeof": "off",
20+
'@angular-eslint/component-selector': [
21+
'error',
22+
{ type: 'element', prefix: 'app', style: 'kebab-case' },
23+
]
11524
},
11625
},
26+
...compat.extends('plugin:@angular-eslint/template/recommended'),
27+
{
28+
files: ['**/*.html'],
29+
rules: {},
30+
},
11731
{
118-
ignores: [
119-
"node_modules/**/*",
120-
"coverage/**/*",
121-
"output/**/*",
122-
"packages/cli/templates/**/*",
123-
"**/files/**/*",
124-
],
32+
ignores: ['projects/**/*']
12533
},
12634
];

packages/igx-templates/igx-ts/projects/_base/files/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"@typescript-eslint/parser": "~8.21.0",
4747
"eslint": "~9.20.0",
4848
"eslint-plugin-import": "^2.29.1",
49-
"eslint-plugin-prefer-arrow": "^1.2.3",
50-
"eslint-plugin-unicorn": "^52.0.0",
49+
"eslint-plugin-prefer-arrow": "^1.2.3",
50+
"eslint-plugin-unicorn": "^52.0.0",
5151
"igniteui-cli": "~<%=cliVersion%>",
5252
"jasmine-core": "~5.1.0",
5353
"karma": "~6.4.0",

0 commit comments

Comments
 (0)