From 80905538500d32a6f716fb1359e59de9fb418d02 Mon Sep 17 00:00:00 2001 From: Richard Hallows Date: Wed, 5 Jul 2023 14:47:47 +0100 Subject: [PATCH] Document check of configs in release process (#7047) Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> --- docs/maintainer-guide/releases.md | 14 ++++---- lib/rules/__tests__/index.test.mjs | 51 ++++++++++++++++-------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/docs/maintainer-guide/releases.md b/docs/maintainer-guide/releases.md index e282c9baa4..6bbbe1969b 100644 --- a/docs/maintainer-guide/releases.md +++ b/docs/maintainer-guide/releases.md @@ -2,11 +2,13 @@ 1. Create a [new issue](https://github.com/stylelint/stylelint/issues/new?title=Release+%7Bversion%7D&labels=status%3A+needs+discussion) to announce the planned release: - include the [template checklist](#new-release-issue-template) -2. If necessary, test `main` locally in the: + - if applicable, list any new rules so that we can discuss including them in our configs +2. If necessary, open a pull request to mark those rules in [`docs/user-guide/rules.md`](../user-guide/rules.md). +3. If necessary, test `main` locally in the: 1. [`stylelint/stylelint-config-recommended`](https://github.com/stylelint/stylelint-config-recommended) 2. [`stylelint/stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard) 3. [`stylelint/stylelint.io`](https://github.com/stylelint/stylelint.io) -3. Release Stylelint: +4. Release Stylelint: 1. If necessary, reorder the changelog entries in the "Prepare release" pull request so that the widest-reaching changes come first. 2. Merge the "Prepare release" pull request. 3. Open a terminal window in the `stylelint` repository. @@ -14,18 +16,18 @@ 5. Select the version from the [`np`](https://github.com/sindresorhus/np) prompt that matches the one in the changelog. 6. Confirm the publishing of the package to [www.npmjs.com/package/stylelint](https://www.npmjs.com/package/stylelint). 7. Confirm the creation of the release at [github.com/stylelint/stylelint/releases](https://github.com/stylelint/stylelint/releases). -4. If necessary, release `stylelint-config-*`: +5. If necessary, release `stylelint-config-*`: 1. Change to the `stylelint-config-*` repository. 2. Repeat steps 5 to 8 above for that repository. -5. Update the website: +6. Update the website: 1. Change to the `stylelint.io` repository. 2. Run `npm install https://github.com/stylelint/stylelint/tarball/${new_version} --save-dev` (replacing `${new_version}` with the version number e.g. `14.13.2`). 3. Run `npm test`. 4. Commit these changes. 5. Push these changes. 6. Confirm the deployment of the update to [stylelint.io](https://stylelint.io). -6. Check that [stylelint.io/demo](https://stylelint.io/demo) installs the latest Stylelint and config versions. -7. Compose a tweet that: +7. Check that [stylelint.io/demo](https://stylelint.io/demo) installs the latest Stylelint and config versions. +8. Compose a tweet that: - announces the release - communicates what has changed - links to the appropriate heading in the changelog on [stylelint.io](https://stylelint.io) diff --git a/lib/rules/__tests__/index.test.mjs b/lib/rules/__tests__/index.test.mjs index 4ed741c302..9af63d30d1 100644 --- a/lib/rules/__tests__/index.test.mjs +++ b/lib/rules/__tests__/index.test.mjs @@ -74,36 +74,39 @@ describe('custom message option', () => { }); describe('standard config', () => { - const tmpDir = path.join(__dirname, 'tmp'); - - // NOTE: The use of Promised-based APIs may cause flaky test on CI. - rmSync(tmpDir, { recursive: true, force: true }); - mkdirSync(tmpDir, { recursive: true }); - writeFileSync(path.join(tmpDir, 'package.json'), '{}'); - execSync( - 'npm install --silent --no-package-lock --no-audit --omit=peer stylelint-config-standard', - { cwd: tmpDir }, - ); + // eslint-disable-next-line jest/no-disabled-tests -- To prevent a failure when adding a new rule to the sharable config. See #7045. + describe.skip('due to chicken and egg problem #7045', () => { + const tmpDir = path.join(__dirname, 'tmp'); - const configRules = (name) => { - const config = require(path.join(tmpDir, 'node_modules', name)); + // NOTE: The use of Promised-based APIs may cause flaky test on CI. + rmSync(tmpDir, { recursive: true, force: true }); + mkdirSync(tmpDir, { recursive: true }); + writeFileSync(path.join(tmpDir, 'package.json'), '{}'); + execSync( + 'npm install --silent --no-package-lock --no-audit --omit=peer stylelint-config-standard', + { cwd: tmpDir }, + ); - return Object.keys(config.rules); - }; + const configRules = (name) => { + const config = require(path.join(tmpDir, 'node_modules', name)); - const standardRules = configRules('stylelint-config-standard'); + return Object.keys(config.rules); + }; - standardRules.push(...configRules('stylelint-config-recommended')); + const standardRules = configRules('stylelint-config-standard'); - afterAll(() => { - rmSync(tmpDir, { recursive: true, force: true }); - }); + standardRules.push(...configRules('stylelint-config-recommended')); - test('the rules are not empty', () => { - expect(standardRules).not.toHaveLength(0); - }); + afterAll(() => { + rmSync(tmpDir, { recursive: true, force: true }); + }); + + test('the rules are not empty', () => { + expect(standardRules).not.toHaveLength(0); + }); - test.each(standardRules)('the rule "%s" are present in the rules doc', (name) => { - expect(rulesListDoc).toMatch(new RegExp(`^.+\`${name}\`.+\\|\\s+✅\\s+\\|.+\\|$`, 'm')); + test.each(standardRules)('the rule "%s" are present in the rules doc', (name) => { + expect(rulesListDoc).toMatch(new RegExp(`^.+\`${name}\`.+\\|\\s+✅\\s+\\|.+\\|$`, 'm')); + }); }); });