Skip to content

Commit f608f8d

Browse files
committed
feat(deps): update ESLint and Stylelint configurations, add support for Angular 16+, and improve builder options
1 parent 4112b6c commit f608f8d

21 files changed

+209
-146
lines changed

.eslintrc.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/integration-test.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,22 @@ jobs:
1313
build:
1414
strategy:
1515
matrix:
16-
angular-version: [9, 10, 11, 12, 13, 14, 15]
17-
os: [ubuntu-latest, windows-latest]
16+
include:
17+
- angular-version: 16
18+
node-version: 18
19+
os: ubuntu-latest
20+
- angular-version: 17
21+
node-version: 18
22+
os: ubuntu-latest
23+
- angular-version: 18
24+
node-version: 20
25+
os: ubuntu-latest
26+
- angular-version: 19
27+
node-version: 20
28+
os: ubuntu-latest
29+
- angular-version: 20
30+
node-version: 22
31+
os: ubuntu-latest
1832

1933
runs-on: ${{ matrix.os }}
2034
defaults:
@@ -31,7 +45,7 @@ jobs:
3145
- name: 🏗 Setup node version
3246
uses: actions/setup-node@v3
3347
with:
34-
node-version: 18
48+
node-version: ${{ matrix.node-version }}
3549
cache: 'pnpm'
3650
- run: |
3751
pnpm install --frozen-lockfile
@@ -71,10 +85,20 @@ jobs:
7185
7286
- name: 🚁 Move test & config files into Angular Project Version ${{ matrix.angular-version }}
7387
run: |
74-
cp test/.eslintrc* tmp/angular${{ matrix.angular-version }}
75-
cp test/.stylelintrc* tmp/angular${{ matrix.angular-version }}
88+
cp test/eslint.config.js tmp/angular${{ matrix.angular-version }}
89+
cp test/stylelint.config.js tmp/angular${{ matrix.angular-version }}
7690
rm -rf tmp/angular${{ matrix.angular-version }}/src/app/*
7791
cp test/src/* tmp/angular${{ matrix.angular-version }}/src/app
92+
cd tmp/angular${{ matrix.angular-version }}/src/app
93+
for f in *.ts.bak; do mv -- "$f" "${f%.bak}"; done
94+
for f in *.css.bak; do mv -- "$f" "${f%.bak}"; done
95+
cd -
96+
97+
- name: 🛠️ Patch package.json for ESM in Angular <= 17
98+
if: ${{ matrix.angular-version <= 17 }}
99+
run: |
100+
cd tmp/angular${{ matrix.angular-version }}
101+
jq '. + {"type": "module"}' package.json > package.json.tmp && mv package.json.tmp package.json
78102
79103
- name: 🚀 Run Linter in Angular Project Version ${{ matrix.angular-version }}
80104
run: |
@@ -83,7 +107,7 @@ jobs:
83107
pnpm exec ng lint > result.txt
84108
set -e
85109
cat result.txt
86-
grep -Fx "✖ 5 problems (5 errors, 0 warnings)" result.txt && echo "SUCCESS=1" >> $GITHUB_ENV || echo "SUCCESS=0" >> $GITHUB_ENV
110+
grep -Fx "✖ 15 problems (15 errors, 0 warnings)" result.txt && echo "SUCCESS=1" >> $GITHUB_ENV || echo "SUCCESS=0" >> $GITHUB_ENV
87111
88112
- name: Assert result
89113
if: ${{ env.SUCCESS != 1 }}

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: 🏗 Setup node version
2424
uses: actions/setup-node@v3
2525
with:
26-
node-version: 18
26+
node-version: 22
2727
cache: 'pnpm'
2828

2929
- name: 🏗 Install dependencies

README.md

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Angular ESLint + Stylelint Linter
32

43
[![npm version](https://badge.fury.io/js/@krema%2Fangular-eslint-stylelint-builder.svg)](https://badge.fury.io/js/@krema%2Fangular-eslint-stylelint-builder) ![node workflow](https://github.com/krema/angular-eslint-stylelint-builder/actions/workflows/integration-test.yml/badge.svg) ![node workflow](https://github.com/krema/angular-eslint-stylelint-builder/actions/workflows/unit-test.yml/badge.svg) ![angular versions](https://img.shields.io/badge/angular-v9--v15-%2523DD0031.svg?flat-square&logo=angular&labelColor=ff0000&color=grey)
@@ -160,41 +159,22 @@ You can configure the following options:
160159
<td colspan="5"><b>File Enumeration:</b></td>
161160
</tr>
162161
<tr>
163-
<td>eslintIgnorePath</td>
164-
<td></td>
162+
<td>eslintIgnorePatterns</td>
163+
<td>[]</td>
165164
<td>
166-
A path to a file containing patterns describing files to ignore instead of
167-
$CWD/.eslintignore
165+
Array of glob patterns describing files to ignore (replaces <code>eslintIgnorePath</code> and <code>.eslintignore</code> in ESLint 9+)
168166
</td>
169167
<td></td>
170168
<td>eslint</td>
171169
</tr>
172170
<tr>
173-
<td>stylelintIgnorePath</td>
174-
<td></td>
175-
<td>
176-
A path to a file containing patterns describing files to ignore instead of
177-
$CWD/.stylelintignore
178-
</td>
179-
<td></td>
180-
<td>stylelint</td>
181-
</tr>
182-
<tr>
183-
<td>eslintRulesDir</td>
171+
<td>stylelintIgnorePatterns</td>
184172
<td>[]</td>
185173
<td>
186-
This option allows you to specify another directory from which to load
187-
rules files
174+
Array of glob patterns describing files to ignore (replaces <code>stylelintIgnorePath</code> and <code>.stylelintignore</code> in Stylelint 16+)
188175
</td>
189176
<td></td>
190-
<td>eslint</td>
191-
</tr>
192-
<tr>
193-
<td>eslintResolvePluginsRelativeTo</td>
194-
<td></td>
195-
<td>Changes the folder where plugins are resolved from</td>
196-
<td></td>
197-
<td>eslint</td>
177+
<td>stylelint</td>
198178
</tr>
199179
<tr>
200180
<td colspan="5"><b>Output:</b></td>

eslint.config.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import js from "@eslint/js";
2+
import tseslint from "@typescript-eslint/eslint-plugin";
3+
import tsParser from "@typescript-eslint/parser";
4+
import importPlugin from "eslint-plugin-import";
5+
import prettierPlugin from "eslint-plugin-prettier";
6+
import unusedImportsPlugin from "eslint-plugin-unused-imports";
7+
8+
export default [
9+
js.configs.recommended,
10+
{
11+
files: ["**/*.ts"],
12+
languageOptions: {
13+
parser: tsParser,
14+
parserOptions: {
15+
project: [
16+
"tsconfig.json",
17+
"tsconfig.lib.json",
18+
"tsconfig.spec.json"
19+
],
20+
createDefaultProgram: false,
21+
ecmaVersion: 2022,
22+
sourceType: "module"
23+
},
24+
globals: {
25+
NodeJS: "readonly",
26+
describe: "readonly",
27+
it: "readonly",
28+
beforeEach: "readonly",
29+
afterEach: "readonly",
30+
expect: "readonly",
31+
jest: "readonly",
32+
console: "readonly",
33+
process: "readonly"
34+
}
35+
},
36+
plugins: {
37+
"@typescript-eslint": tseslint,
38+
"unused-imports": unusedImportsPlugin,
39+
"prettier": prettierPlugin,
40+
"import": importPlugin
41+
},
42+
rules: {
43+
"prettier/prettier": "error",
44+
"@typescript-eslint/consistent-type-imports": "error",
45+
"@typescript-eslint/no-unused-vars": [
46+
"error",
47+
{
48+
argsIgnorePattern: "_"
49+
}
50+
],
51+
"@typescript-eslint/array-type": "error",
52+
"@typescript-eslint/ban-ts-comment": "off",
53+
"no-else-return": "error",
54+
"semi": ["error", "always"]
55+
},
56+
settings: {
57+
"import/resolver": {
58+
typescript: {}
59+
}
60+
}
61+
}
62+
];

0 commit comments

Comments
 (0)