Skip to content

Commit 1837a4d

Browse files
authored
ci: testing, migrate to yarn v4 (#305)
1 parent 8dbbd6d commit 1837a4d

17 files changed

+7929
-11092
lines changed

.changeset/large-dodos-carry.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"eslint-config-prettier": patch
33
---
44

5-
Add name to config
5+
feat: add name to config

.eslintignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
!/.*
2-
build/**
3-
test-config/**
1+
.yarn
2+
build
3+
test-config

.eslintrc.js

+6
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,11 @@ module.exports = {
4040
files: ["**/*.test.js"],
4141
env: { jest: true },
4242
},
43+
{
44+
files: ["**/*.d.ts"],
45+
rules: {
46+
strict: "off",
47+
},
48+
},
4349
],
4450
};

.github/workflows/check.yml

+10-16
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@ permissions:
1414
contents: read
1515

1616
jobs:
17-
main:
18-
runs-on: ${{ matrix.os }}
19-
20-
strategy:
21-
matrix:
22-
os: [ubuntu-latest]
23-
node-version: [20]
24-
fail-fast: false
17+
check:
18+
runs-on: ubuntu-latest
2519

2620
steps:
2721
- uses: actions/checkout@v4
@@ -30,22 +24,22 @@ jobs:
3024

3125
- uses: actions/setup-node@v4
3226
with:
33-
node-version: ${{ matrix.node-version }}
34-
cache: npm
27+
node-version: lts/*
28+
cache: yarn
3529

36-
- name: npm ci
37-
run: npm ci --no-audit
30+
- name: Install Dependencies
31+
run: yarn --immutable
3832

3933
- name: ESLint - flat
40-
run: npx eslint .
34+
run: yarn test:eslint
4135

4236
- name: ESLint - eslintrc
43-
run: npx eslint .
37+
run: yarn test:eslint
4438
env:
4539
ESLINT_USE_FLAT_CONFIG: "false"
4640

4741
- name: Prettier
48-
run: npx prettier --check .
42+
run: yarn prettier --check .
4943

5044
- name: Build
51-
run: npm run build
45+
run: yarn build

.github/workflows/release.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,18 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: lts/*
23-
cache: npm
23+
cache: yarn
2424

2525
- name: Install Dependencies
26-
run: npm ci
26+
run: yarn --immutable
2727

2828
- name: Create Release Pull Request or Publish to npm
2929
id: changesets
3030
uses: changesets/action@v1
3131
with:
3232
commit: "chore: release eslint-config-prettier"
3333
title: "chore: release eslint-config-prettier"
34-
publish: npm run release
35-
version: npm run version
34+
publish: yarn release
3635
env:
3736
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3837
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

+24-12
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,27 @@ permissions:
1414
contents: read
1515

1616
jobs:
17-
main:
17+
test:
18+
name: Test on ${{ matrix.os }} with Node.js ${{ matrix.node-version }}
19+
1820
runs-on: ${{ matrix.os }}
1921

2022
strategy:
2123
matrix:
22-
os: [ubuntu-latest, windows-latest, macOS-latest]
23-
node-version: [16, 18, 20, 22]
24+
os:
25+
- macOS-latest
26+
- ubuntu-latest
27+
- windows-latest
28+
node-version:
29+
- 16
30+
- 18
31+
- 20
32+
- 22
2433
fail-fast: false
2534

35+
env:
36+
YARN_IGNORE_NODE: 1
37+
2638
steps:
2739
- uses: actions/checkout@v4
2840
with:
@@ -31,33 +43,33 @@ jobs:
3143
- uses: actions/setup-node@v4
3244
with:
3345
node-version: ${{ matrix.node-version }}
34-
cache: npm
46+
cache: yarn
3547

36-
- name: npm ci
37-
run: npm ci --no-audit
48+
- name: Install Dependencies
49+
run: yarn --immutable
3850

3951
- name: Jest - flat
40-
run: npx jest
52+
run: yarn test:jest
4153
env:
4254
ESLINT_CONFIG_PRETTIER_NO_DEPRECATED: "true"
4355

4456
- name: Jest - eslintrc
45-
run: npx jest
57+
run: yarn test:jest
4658
env:
4759
ESLINT_USE_FLAT_CONFIG: "false"
4860

4961
- name: CLI sanity - flat
50-
run: npm run test:cli-sanity
62+
run: yarn test:cli-sanity
5163

5264
- name: CLI sanity - eslintrc
53-
run: npm run test:cli-sanity
65+
run: yarn test:cli-sanity
5466
env:
5567
ESLINT_USE_FLAT_CONFIG: "false"
5668

5769
- name: CLI sanity warning - flat
58-
run: npm run test:cli-sanity-warning
70+
run: yarn test:cli-sanity-warning
5971

6072
- name: CLI sanity warning - eslintrc
61-
run: npm run test:cli-sanity-warning
73+
run: yarn test:cli-sanity-warning
6274
env:
6375
ESLINT_USE_FLAT_CONFIG: "false"

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
.yarn/*
2+
!.yarn/plugins
3+
!.yarn/releases
14
/build/
25
/node_modules/
36
/test-config/
4-
/.idea/
7+
/.idea/

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.yarn
12
/build/
23
/test-config/
34
.vscode

.prettierrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"proseWrap": "never",
33
"quoteProps": "consistent",
4-
"trailingComma": "es5"
4+
"trailingComma": "es5",
5+
"plugins": ["prettier-plugin-pkg"]
56
}

.yarn/releases/yarn-4.7.0.cjs

+935
Large diffs are not rendered by default.

.yarnrc.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enableTelemetry: false
2+
3+
nodeLinker: node-modules
4+
5+
yarnPath: .yarn/releases/yarn-4.7.0.cjs

eslint.config.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
const globals = require("globals");
1212
const base = require("./eslint.base.config");
13-
const index = require(".");
13+
const index = require("./index.js");
1414
const prettier = require("./prettier");
1515
const eslintrc = require("./.eslintrc");
1616

@@ -34,10 +34,4 @@ module.exports = [
3434
},
3535
})
3636
),
37-
{
38-
files: ["**/*.d.ts"],
39-
rules: {
40-
strict: "off",
41-
},
42-
},
4337
];

index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"use strict";
22

3-
// const { version } = require("eslint/package.json");
3+
const { version } = require("eslint/package.json");
44

55
const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
66

77
const specialRule = 0;
88

9-
// if (+version.split(".")[0] >= 9) {
10-
// exports.name = "config-prettier";
11-
// }
9+
if (+version.split(".")[0] >= 9) {
10+
exports.name = "config-prettier";
11+
}
1212

1313
exports.rules = {
1414
// The following rules can be used in some cases. See the README for more

0 commit comments

Comments
 (0)