Skip to content

Commit 131d4dd

Browse files
committed
feat(stylelint): migrate to ESM for Stylelint to remove CommonJS API usage
BREAKING CHANGE: The CommonJS Node.js API for Stylelint has been deprecated and will be removed in the next major release. This commit updates `@krema/angular-eslint-stylelint-builder` and related configurations to utilize Stylelint's ECMAScript Modules (ESM) API. Plugin authors or users of `stylelint.lint()` directly within their projects may need to adjust their imports or configurations to use ESM. Custom syntaxes and formatters are not affected. The previous `DeprecationWarning: The CommonJS Node.js API is deprecated` message on `ng lint` will no longer appear. See Stylelint migration guide: https://stylelint.io/migration-guide/to-16 chore(test): convert to vitest ci(actions): disable fail fast
1 parent bc7f7d4 commit 131d4dd

37 files changed

+9483
-888
lines changed

.github/workflows/integration-test.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,9 @@ permissions:
1212
jobs:
1313
build:
1414
strategy:
15+
fail-fast: false
1516
matrix:
1617
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
2318
- angular-version: 18
2419
node-version: 20
2520
os: ubuntu-latest

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright © 2022 André Kremser
3+
Copyright © 2025 André Kremser
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ A unified Angular CLI builder for linting Angular projects with [ESLint](https:/
1010

1111
## Version Compatibility
1212

13-
- **v1.x**: Supports Angular **9–16**, Stylelint **≤15**, and ESLint **≤8**
14-
- **v2.x and above**: Supports Angular **17+**, Stylelint **16+**, and ESLint **9+**
13+
- **v1.x**: Supports Angular **9–15**, Stylelint **≤15**, and ESLint **≤8**
14+
- **v2.x**: Supports Angular **16-17**, Stylelint **16+**, and ESLint **9+**
15+
- **v3.x**: Supports Angular **18+**, Stylelint **16+**, and ESLint **9+**
1516

1617
---
1718

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import prettierPlugin from "eslint-plugin-prettier";
66
import unusedImportsPlugin from "eslint-plugin-unused-imports";
77

88
export default [
9+
{
10+
ignores: ["example/**"],
11+
},
912
js.configs.recommended,
1013
{
1114
files: ["**/*.ts"],

example/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Example: Angular App Usage for angular-eslint-stylelint-builder
2+
3+
This folder contains an example Angular v20 app to demonstrate and test the builder library in a real project setup.
4+
5+
## Structure
6+
- `app/` — Angular v20 application
7+
- `eslint.config.js` — ESLint config for the app
8+
- `stylelint.config.js` — Stylelint config for the app
9+
- `src/` — Angular source files
10+
11+
## How to Use
12+
1. Build the builder library (from the project root):
13+
```sh
14+
cd ../../
15+
pnpm build
16+
```
17+
18+
2. Install dependencies for the Angular app:
19+
```sh
20+
cd example/app
21+
pnpm install
22+
```
23+
3. Run the builder lint task in the Angular app:
24+
```sh
25+
pnpm exec ng lint
26+
```
27+
28+
This will lint both TypeScript/HTML (ESLint) and CSS (Stylelint) files using your builder.
29+
30+
---
31+
32+
You can add or modify files in `example/app/src/` to test linting functionality and error reporting.

example/app/.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
ij_typescript_use_double_quotes = false
14+
15+
[*.md]
16+
max_line_length = off
17+
trim_trailing_whitespace = false

example/app/.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3+
"recommendations": ["angular.ng-template"]
4+
}

example/app/.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"name": "ng serve",
7+
"type": "chrome",
8+
"request": "launch",
9+
"preLaunchTask": "npm: start",
10+
"url": "http://localhost:4200/"
11+
},
12+
{
13+
"name": "ng test",
14+
"type": "chrome",
15+
"request": "launch",
16+
"preLaunchTask": "npm: test",
17+
"url": "http://localhost:9876/debug.html"
18+
}
19+
]
20+
}

example/app/.vscode/tasks.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3+
"version": "2.0.0",
4+
"tasks": [
5+
{
6+
"type": "npm",
7+
"script": "start",
8+
"isBackground": true,
9+
"problemMatcher": {
10+
"owner": "typescript",
11+
"pattern": "$tsc",
12+
"background": {
13+
"activeOnStart": true,
14+
"beginsPattern": {
15+
"regexp": "(.*?)"
16+
},
17+
"endsPattern": {
18+
"regexp": "bundle generation complete"
19+
}
20+
}
21+
}
22+
},
23+
{
24+
"type": "npm",
25+
"script": "test",
26+
"isBackground": true,
27+
"problemMatcher": {
28+
"owner": "typescript",
29+
"pattern": "$tsc",
30+
"background": {
31+
"activeOnStart": true,
32+
"beginsPattern": {
33+
"regexp": "(.*?)"
34+
},
35+
"endsPattern": {
36+
"regexp": "bundle generation complete"
37+
}
38+
}
39+
}
40+
}
41+
]
42+
}

0 commit comments

Comments
 (0)