Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions node-packages/stylelint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

## [2.0.0] - 2026-11-20

### Changed

- **Breaking:** requires Stylelint 17 and Node.js 22.23.4 or later. The peer ranges are `stylelint` `^17.14.1`, `@wordpress/stylelint-config` `^25.0.0 || ^26.0.0 || ^27.0.0` and `stylelint-scss` `^7.2.0`, matching `@wordpress/scripts` 35 and later. To upgrade from 1.x: if the install reports `ERESOLVE`, `npm uninstall @rtcamp/stylelint-config` (plus any Stylelint 16 `stylelint`, `@wordpress/stylelint-config` or `stylelint-scss` in `package.json`) and install again.

## [1.1.0] - 2026-10-01

### Changed
Expand Down
16 changes: 12 additions & 4 deletions node-packages/stylelint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p align="center">
<a href="https://github.com/rtCamp/wp-tooling/blob/main/node-packages/stylelint-config/LICENSE"><img src="https://img.shields.io/badge/license-GPL--2.0--or--later-blue.svg" alt="License: GPL-2.0-or-later"></a>
<a href="https://www.npmjs.com/package/@rtcamp/stylelint-config"><img src="https://img.shields.io/npm/v/@rtcamp/stylelint-config.svg" alt="npm version"></a>
<img src="https://img.shields.io/badge/node-%3E%3D22.19-339933.svg" alt="Node 22.19+">
<img src="https://img.shields.io/badge/node-%3E%3D22.23.4-339933.svg" alt="Node 22.23.4+">
</p>

<p align="center">
Expand All @@ -17,13 +17,21 @@ It extends

## Install

Requires Node.js 22.19+.
Requires
- Node.js 22.23.4+
- Stylelint 17+.

With `@wordpress/scripts` 35+:

```bash
npm install --save-dev @rtcamp/stylelint-config stylelint @wordpress/stylelint-config stylelint-scss
npm install --save-dev @rtcamp/stylelint-config
```

`stylelint`, `@wordpress/stylelint-config` and `stylelint-scss` are peer dependencies.
Without `@wordpress/scripts`, install the peerDependencies directly:

```bash
npm install --save-dev @rtcamp/stylelint-config stylelint@^17 @wordpress/stylelint-config@^27 stylelint-scss@^7
```

## Usage

Expand Down
10 changes: 5 additions & 5 deletions node-packages/stylelint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rtcamp/stylelint-config",
"version": "1.1.0",
"version": "2.0.0",
"description": "rtCamp shareable Stylelint config for WordPress projects — extends @wordpress/stylelint-config (+ scss).",
"license": "GPL-2.0-or-later",
"author": "rtCamp",
Expand All @@ -18,7 +18,7 @@
"access": "public"
},
"engines": {
"node": ">=22.19"
"node": ">=22.23.4"
},
"main": "index.js",
"files": [
Expand All @@ -40,9 +40,9 @@
"check": "npm run lint && npm test"
},
"peerDependencies": {
"@wordpress/stylelint-config": "^23.37.0",
"stylelint": "^16.8.2",
"stylelint-scss": "^6.4.0"
"@wordpress/stylelint-config": "^25.0.0 || ^26.0.0 || ^27.0.0",
"stylelint": "^17.14.1",
"stylelint-scss": "^7.2.0"
},
"devDependencies": {
"@rtcamp/eslint-config": "^2.0.0",
Expand Down
50 changes: 50 additions & 0 deletions node-packages/stylelint-config/tests/stylelint.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
'use strict';

const { spawnSync } = require('node:child_process');
const path = require('node:path');

const config = require('../index');

// Import via a separate node process since Stylelint 17 is ESM-only.
const cli = path.join(
path.dirname(require.resolve('stylelint')),
'../bin/stylelint.mjs'
);

/**
* Lint source code with this package's config.
*
* @param {string} code - CSS or SCSS source.
* @param {string} filename - Virtual file name.
* @return {string[]} The rules that reported a problem.
*/
const lint = (code, filename) => {
const { stderr } = spawnSync(
process.execPath,
[
cli,
'--config',
path.join(__dirname, '../index.js'),
'--stdin-filename',
filename,
'--formatter',
'json',
],
{ input: code, encoding: 'utf8' }
);
return JSON.parse(stderr)[0].warnings.map((warning) => warning.rule);
};

describe('stylelint config', () => {
it('exports a plain object', () => {
expect(typeof config).toBe('object');
Expand All @@ -16,4 +49,21 @@ describe('stylelint config', () => {
it('extends @wordpress/stylelint-config/scss', () => {
expect(config.extends).toContain('@wordpress/stylelint-config/scss');
});

it('passes clean CSS and SCSS', () => {
expect(lint('a {\n\tcolor: #fff;\n}\n', 'style.css')).toEqual([]);
expect(
lint('$color: #fff;\n\na {\n\tcolor: $color;\n}\n', 'style.scss')
).toEqual([]);
});

it('reports CSS problems', () => {
expect(lint('a {}\n', 'style.css')).toEqual(['block-no-empty']);
});

it('reports SCSS problems', () => {
expect(lint('a {\n\t@extend .button;\n}\n', 'style.scss')).toEqual([
'scss/at-extend-no-missing-placeholder',
]);
});
});
1 change: 1 addition & 0 deletions node-packages/wp-tooling/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- `detect-changes` counts linter configs in the bucket they configure. The `css` bucket gains `.stylelintrc*`, `stylelint.config.*` and `.stylelintignore`. The `js` bucket gains `.eslintrc*`, `.eslintignore`, `.prettierrc*`, `.prettierignore`, `.babelrc*` and `babel.config.json`; `eslint.config.*`, `prettier.config.*` and `babel.config.js` already matched by extension. A config-only change used to skip the linter whose rules it changed.
- `detect-changes` diffs with `--no-renames`, so a rename lists the old path as well as the new one and a caller can treat the old path as removed. `total-count` counts a rename as two files.
- `lint/eslint` installs `@rtcamp/eslint-config` 2 with `@wordpress/eslint-plugin` 28, the version `@wordpress/scripts` 37 depends on, plus `eslint-plugin-jest` 29, which the config made an optional peer in 2.0. The rendered `eslint.config.js` uses the `@rtcamp/eslint-config/jest` entry when Jest is installed and the default (Vitest) entry otherwise. `lint:js` and `lint:js:fix` lint the `src` and `assets` directories instead of `*.js` globs, so `.jsx` and TypeScript files are linted too. The `setup` skill and `docs/examples.md` show the same pins and scripts.
- `lint/stylelint` installs `@rtcamp/stylelint-config` 2 with `@wordpress/stylelint-config` 27, Stylelint 17 and `stylelint-scss` 7, the versions `@wordpress/scripts` 37 depends on.

## [2.0.0] - 2026-10-01

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
}
],
"npm_dev_dependencies": {
"stylelint": "^16.8.2",
"@wordpress/stylelint-config": "^23.37.0",
"stylelint-scss": "^6.4.0",
"@rtcamp/stylelint-config": "^1.1.0"
"stylelint": "^17.14.1",
"@wordpress/stylelint-config": "^27.0.0",
"stylelint-scss": "^7.2.0",
"@rtcamp/stylelint-config": "^2.0.0"
},
"scripts": {
"npm": {
Expand Down
Loading