Skip to content

Commit

Permalink
chore: Enable Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Aug 21, 2024
1 parent d79c42b commit b3c94e3
Show file tree
Hide file tree
Showing 55 changed files with 5,338 additions and 5,010 deletions.
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 }}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
CHANGELOG.md
jsr.json
81 changes: 40 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ npm install --save-dev eslint @eslint/markdown

### Configurations

| **Configuration Name** | **Description** |
|---------------|-----------------|
| `recommended` | Lints all `.md` files with the recommended rules and assumes [CommonMark](https://commonmark.org/) format. |
| `processor` | Enables extracting code blocks from all `.md` files so code blocks can be individually linted. |
| **Configuration Name** | **Description** |
| ---------------------- | ---------------------------------------------------------------------------------------------------------- |
| `recommended` | Lints all `.md` files with the recommended rules and assumes [CommonMark](https://commonmark.org/) format. |
| `processor` | Enables extracting code blocks from all `.md` files so code blocks can be individually linted. |

In your `eslint.config.js` file, import `@eslint/markdown` and include the recommended config to enable the Markdown processor on all `.md` files:

Expand All @@ -37,23 +37,23 @@ In your `eslint.config.js` file, import `@eslint/markdown` and include the recom
import markdown from "@eslint/markdown";

export default [
...markdown.configs.recommended
...markdown.configs.recommended,

// your other configs here
// your other configs here
];
```

### Rules

| **Rule Name** | **Description** |
|---------------|-----------------|
| [`fenced-code-language`](./docs/rules/fenced-code-language.md) | Enforce fenced code blocks to specify a language. |
| [`heading-increment`](./docs/rules/heading-increment.md) | Enforce heading levels increment by one. |
| **Rule Name** | **Description** |
| ---------------------------------------------------------------- | ------------------------------------------------- |
| [`fenced-code-language`](./docs/rules/fenced-code-language.md) | Enforce fenced code blocks to specify a language. |
| [`heading-increment`](./docs/rules/heading-increment.md) | Enforce heading levels increment by one. |
| [`no-duplicate-headings`](./docs/rules/no-duplicate-headings.md) | Disallow duplicate headings in the same document. |
| [`no-empty-links`](./docs/rules/no-empty-links.md) | Disallow empty links. |
| [`no-html`](./docs/rules/no-html.md) | Enforce fenced code blocks to specify a language. |
| [`no-invalid-label-refs`](./docs/rules/no-invalid-label-refs.md) | Disallow invalid label references. |
| [`no-missing-label-refs`](./docs/rules/no-missing-label-refs.md) | Disallow missing label references. |
| [`no-empty-links`](./docs/rules/no-empty-links.md) | Disallow empty links. |
| [`no-html`](./docs/rules/no-html.md) | Enforce fenced code blocks to specify a language. |
| [`no-invalid-label-refs`](./docs/rules/no-invalid-label-refs.md) | Disallow invalid label references. |
| [`no-missing-label-refs`](./docs/rules/no-missing-label-refs.md) | Disallow missing label references. |

**Note:** This plugin does not provide formatting rules. We recommend using a source code formatter such as [Prettier](https://prettier.io) for that purpose.

Expand All @@ -64,25 +64,24 @@ In order to individually configure a rule in your `eslint.config.js` file, impor
import markdown from "@eslint/markdown";

export default [
{
files: ["**/*.md"],
plugins: {
markdown
},
rules: {
"markdown/no-html": "error"
}
}
{
files: ["**/*.md"],
plugins: {
markdown,
},
rules: {
"markdown/no-html": "error",
},
},
];
```

### Languages

| **Language Name** | **Description** |
|---------------|-----------------|
| `commonmark` | Parse using [CommonMark](https://commonmark.org) Markdown format |
| `gfm` | Parse using [GitHub-Flavored Markdown](https://github.github.com/gfm/) format |

| **Language Name** | **Description** |
| ----------------- | ----------------------------------------------------------------------------- |
| `commonmark` | Parse using [CommonMark](https://commonmark.org) Markdown format |
| `gfm` | Parse using [GitHub-Flavored Markdown](https://github.github.com/gfm/) format |

In order to individually configure a language in your `eslint.config.js` file, import `@eslint/markdown` and configure a `language`:

Expand All @@ -91,24 +90,24 @@ In order to individually configure a language in your `eslint.config.js` file, i
import markdown from "@eslint/markdown";

export default [
{
files: ["**/*.md"],
plugins: {
markdown
},
language: "markdown/gfm",
rules: {
"markdown/no-html": "error"
}
}
{
files: ["**/*.md"],
plugins: {
markdown,
},
language: "markdown/gfm",
rules: {
"markdown/no-html": "error",
},
},
];
```

### Processors

| **Processor Name** | **Description** |
|---------------|-----------------|
| [`markdown`](./docs/processors/markdown.md) | Extract fenced code blocks from the Markdown code so they can be linted separately. |
| **Processor Name** | **Description** |
| ------------------------------------------- | ----------------------------------------------------------------------------------- |
| [`markdown`](./docs/processors/markdown.md) | Extract fenced code blocks from the Markdown code so they can be linted separately. |

## Editor Integrations

Expand Down
Loading

0 comments on commit b3c94e3

Please sign in to comment.