Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Enable Prettier #270

Merged
merged 3 commits into from
Aug 27, 2024
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
36 changes: 18 additions & 18 deletions .github/workflows/add-to-triage.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Add to Triage
on:
issues:
types:
- opened
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/eslint/projects/3
github-token: ${{ secrets.PROJECT_BOT_TOKEN }}
labeled: "triage:no"
label-operator: NOT
name: Add to Triage

on:
issues:
types:
- opened

jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/eslint/projects/3
github-token: ${{ secrets.PROJECT_BOT_TOKEN }}
labeled: "triage:no"
label-operator: NOT
117 changes: 67 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,73 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Packages
run: npm install
env:
CI: true
- name: Lint
run: npm run lint
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Packages
run: npm install
env:
CI: true
- name: Lint
run: npm run lint

test:
name: Test
strategy:
matrix:
os: [ubuntu-latest]
eslint: [9]
node: [22.x, 21.x, 20.x, 18.x, "18.18.0"]
include:
- os: windows-latest
eslint: 9
node: 20
- os: macOS-latest
eslint: 9
node: 20
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install Packages
run: npm install
env:
CI: true
- name: Install ESLint@${{ matrix.eslint }}
run: npm install eslint@${{ matrix.eslint }}
- name: Test
run: npm run test
format:
name: File Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Packages
run: npm install
env:
CI: true
- name: Prettier Check
run: npm run fmt:check

test:
name: Test
strategy:
matrix:
os: [ubuntu-latest]
eslint: [9]
node: [22.x, 21.x, 20.x, 18.x, "18.18.0"]
include:
- os: windows-latest
eslint: 9
node: 20
- os: macOS-latest
eslint: 9
node: 20
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install Packages
run: npm install
env:
CI: true
- name: Install ESLint@${{ matrix.eslint }}
run: npm install eslint@${{ matrix.eslint }}
- name: Test
run: npm run test
76 changes: 38 additions & 38 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
on:
push:
branches:
- main
push:
branches:
- main
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- uses: googleapis/release-please-action@v4
id: release
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
if: ${{ steps.release.outputs.release_created }}
- run: |
npm install
npm run build --if-present
npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
- run: 'npx @humanwhocodes/tweet "eslint/markdown v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released: ${{ steps.release.outputs.html_url }}"'
if: ${{ steps.release.outputs.release_created }}
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
- run: 'npx @humanwhocodes/toot "eslint/markdown v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released: ${{ steps.release.outputs.html_url }}"'
if: ${{ steps.release.outputs.release_created }}
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- uses: googleapis/release-please-action@v4
id: release
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
if: ${{ steps.release.outputs.release_created }}
- run: |
npm install
npm run build --if-present
npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
- run: 'npx @humanwhocodes/tweet "eslint/markdown v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released: ${{ steps.release.outputs.html_url }}"'
if: ${{ steps.release.outputs.release_created }}
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
- run: 'npx @humanwhocodes/toot "eslint/markdown v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released: ${{ steps.release.outputs.html_url }}"'
if: ${{ steps.release.outputs.release_created }}
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
CHANGELOG.md
jsr.json
**/*.md
10 changes: 5 additions & 5 deletions eslint.config-content.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import markdown from "./src/index.js";

export default [
{
name: "markdown/content/ignores",
ignores: ["**/*.js", "**/.cjs", "**/.mjs"]
},
...markdown.configs.recommended
{
name: "markdown/content/ignores",
ignores: ["**/*.js", "**/.cjs", "**/.mjs"],
},
...markdown.configs.recommended,
];
128 changes: 63 additions & 65 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,69 @@
import globals from "globals";
import eslintConfigESLint from "eslint-config-eslint";
import eslintConfigESLintFormatting from "eslint-config-eslint/formatting";
import markdown from "./src/index.js";

export default [
...eslintConfigESLint,
eslintConfigESLintFormatting,
{
name: "markdown/plugins",
plugins: {
markdown
}
},
{
name: "markdown/ignores",
ignores: [
"**/examples",
"**/coverage",
"**/tests/fixtures",
"dist",
"src/build/"
]
},
{
name: "markdown/tools",
files: ["tools/**/*.js"],
rules: {
"no-console": "off"
}
},
{
name: "markdown/tests",
files: ["tests/**/*.js"],
languageOptions: {
globals: {
...globals.mocha
}
},
rules: {
"no-underscore-dangle": "off"
}
},
{
name: "markdown/code-blocks",
files: ["**/*.md"],
processor: "markdown/markdown"
},
{
name: "markdown/code-blocks/js",
files: ["**/*.md/*.js"],
languageOptions: {
sourceType: "module",
parserOptions: {
ecmaFeatures: {
impliedStrict: true
}
}
},
rules: {
"lines-around-comment": "off",
"n/no-missing-import": "off",
"no-var": "off",
"padding-line-between-statements": "off",
"no-console": "off",
"no-alert": "off",
"@eslint-community/eslint-comments/require-description": "off",
"jsdoc/require-jsdoc": "off"
}
}
...eslintConfigESLint,
{
name: "markdown/plugins",
plugins: {
markdown,
},
},
{
name: "markdown/ignores",
ignores: [
"**/examples",
"**/coverage",
"**/tests/fixtures",
"dist",
"src/build/",
],
},
{
name: "markdown/tools",
files: ["tools/**/*.js"],
rules: {
"no-console": "off",
},
},
{
name: "markdown/tests",
files: ["tests/**/*.js"],
languageOptions: {
globals: {
...globals.mocha,
},
},
rules: {
"no-underscore-dangle": "off",
},
},
{
name: "markdown/code-blocks",
files: ["**/*.md"],
processor: "markdown/markdown",
},
{
name: "markdown/code-blocks/js",
files: ["**/*.md/*.js"],
languageOptions: {
sourceType: "module",
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},
rules: {
"lines-around-comment": "off",
"n/no-missing-import": "off",
"no-var": "off",
"padding-line-between-statements": "off",
"no-console": "off",
"no-alert": "off",
"@eslint-community/eslint-comments/require-description": "off",
"jsdoc/require-jsdoc": "off",
},
},
];
Loading