Skip to content

Commit

Permalink
ci: testing, migrate to yarn v4 (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Mar 7, 2025
1 parent 8dbbd6d commit 1837a4d
Show file tree
Hide file tree
Showing 17 changed files with 7,929 additions and 11,092 deletions.
2 changes: 1 addition & 1 deletion .changeset/large-dodos-carry.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"eslint-config-prettier": patch
---

Add name to config
feat: add name to config
6 changes: 3 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
!/.*
build/**
test-config/**
.yarn
build
test-config
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ module.exports = {
files: ["**/*.test.js"],
env: { jest: true },
},
{
files: ["**/*.d.ts"],
rules: {
strict: "off",
},
},
],
};
26 changes: 10 additions & 16 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ permissions:
contents: read

jobs:
main:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node-version: [20]
fail-fast: false
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -30,22 +24,22 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
node-version: lts/*
cache: yarn

- name: npm ci
run: npm ci --no-audit
- name: Install Dependencies
run: yarn --immutable

- name: ESLint - flat
run: npx eslint .
run: yarn test:eslint

- name: ESLint - eslintrc
run: npx eslint .
run: yarn test:eslint
env:
ESLINT_USE_FLAT_CONFIG: "false"

- name: Prettier
run: npx prettier --check .
run: yarn prettier --check .

- name: Build
run: npm run build
run: yarn build
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache: yarn

- name: Install Dependencies
run: npm ci
run: yarn --immutable

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
commit: "chore: release eslint-config-prettier"
title: "chore: release eslint-config-prettier"
publish: npm run release
version: npm run version
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36 changes: 24 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,27 @@ permissions:
contents: read

jobs:
main:
test:
name: Test on ${{ matrix.os }} with Node.js ${{ matrix.node-version }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
node-version: [16, 18, 20, 22]
os:
- macOS-latest
- ubuntu-latest
- windows-latest
node-version:
- 16
- 18
- 20
- 22
fail-fast: false

env:
YARN_IGNORE_NODE: 1

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -31,33 +43,33 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache: yarn

- name: npm ci
run: npm ci --no-audit
- name: Install Dependencies
run: yarn --immutable

- name: Jest - flat
run: npx jest
run: yarn test:jest
env:
ESLINT_CONFIG_PRETTIER_NO_DEPRECATED: "true"

- name: Jest - eslintrc
run: npx jest
run: yarn test:jest
env:
ESLINT_USE_FLAT_CONFIG: "false"

- name: CLI sanity - flat
run: npm run test:cli-sanity
run: yarn test:cli-sanity

- name: CLI sanity - eslintrc
run: npm run test:cli-sanity
run: yarn test:cli-sanity
env:
ESLINT_USE_FLAT_CONFIG: "false"

- name: CLI sanity warning - flat
run: npm run test:cli-sanity-warning
run: yarn test:cli-sanity-warning

- name: CLI sanity warning - eslintrc
run: npm run test:cli-sanity-warning
run: yarn test:cli-sanity-warning
env:
ESLINT_USE_FLAT_CONFIG: "false"
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.yarn/*
!.yarn/plugins
!.yarn/releases
/build/
/node_modules/
/test-config/
/.idea/
/.idea/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.yarn
/build/
/test-config/
.vscode
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"proseWrap": "never",
"quoteProps": "consistent",
"trailingComma": "es5"
"trailingComma": "es5",
"plugins": ["prettier-plugin-pkg"]
}
935 changes: 935 additions & 0 deletions .yarn/releases/yarn-4.7.0.cjs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enableTelemetry: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.7.0.cjs
8 changes: 1 addition & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

const globals = require("globals");
const base = require("./eslint.base.config");
const index = require(".");
const index = require("./index.js");
const prettier = require("./prettier");
const eslintrc = require("./.eslintrc");

Expand All @@ -34,10 +34,4 @@ module.exports = [
},
})
),
{
files: ["**/*.d.ts"],
rules: {
strict: "off",
},
},
];
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"use strict";

// const { version } = require("eslint/package.json");
const { version } = require("eslint/package.json");

const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;

const specialRule = 0;

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

exports.rules = {
// The following rules can be used in some cases. See the README for more
Expand Down
Loading

0 comments on commit 1837a4d

Please sign in to comment.