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

feat!: Rename to @eslint/markdown #265

Merged
merged 8 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 2 additions & 2 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
- run: 'npx @humanwhocodes/tweet "eslint-plugin-markdown v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released: ${{ steps.release.outputs.html_url }}"'
- 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-plugin-markdown v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released: ${{ steps.release.outputs.html_url }}"'
- 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 }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing Code

Please sign the ESLint [Contributor License Agreement](https://cla.js.foundation/eslint/eslint-plugin-markdown)
Please sign the ESLint [Contributor License Agreement](https://eslint.org/cla)

## Full Documentation

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright JS Foundation and other contributors, https://js.foundation
Copyright OpenJS Foundation and other contributors, https://openjsf.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# eslint-plugin-markdown
# ESLint Markdown Language Plugin

[![npm Version](https://img.shields.io/npm/v/eslint-plugin-markdown.svg)](https://www.npmjs.com/package/eslint-plugin-markdown)
[![Downloads](https://img.shields.io/npm/dm/eslint-plugin-markdown.svg)](https://www.npmjs.com/package/eslint-plugin-markdown)
[![Build Status](https://github.com/eslint/eslint-plugin-markdown/workflows/CI/badge.svg)](https://github.com/eslint/eslint-plugin-markdown/actions)
[![npm Version](https://img.shields.io/npm/v/@eslint/markdown.svg)](https://www.npmjs.com/package/@eslint/markdown)
[![Downloads](https://img.shields.io/npm/dm/@eslint/markdown.svg)](https://www.npmjs.com/package/@eslint/markdown)
[![Build Status](https://github.com/eslint/markdown/workflows/CI/badge.svg)](https://github.com/eslint/markdown/actions)

Lint JS, JSX, TypeScript, and more inside Markdown.

Expand All @@ -20,16 +20,16 @@ Lint JS, JSX, TypeScript, and more inside Markdown.
Install the plugin alongside ESLint v8 or greater:

```sh
npm install --save-dev eslint eslint-plugin-markdown
npm install --save-dev eslint @eslint/markdown
```

### Configuring

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

```js
// eslint.config.js
import markdown from "eslint-plugin-markdown";
import markdown from "@eslint/markdown";

export default [
...markdown.configs.recommended
Expand Down Expand Up @@ -59,7 +59,7 @@ Here's an example:

```js
// eslint.config.js
import markdown from "eslint-plugin-markdown";
import markdown from "@eslint/markdown";

export default [
{
Expand Down Expand Up @@ -102,7 +102,7 @@ Use glob patterns to disable more rules just for Markdown code blocks:

```js
// / eslint.config.js
import markdown from "eslint-plugin-markdown";
import markdown from "@eslint/markdown";

export default [
{
Expand Down Expand Up @@ -271,15 +271,15 @@ console.log("This code block is linted normally.");

The [`linter-eslint`](https://atom.io/packages/linter-eslint) package allows for linting within the [Atom IDE](https://atom.io/).

In order to see `eslint-plugin-markdown` work its magic within Markdown code blocks in your Atom editor, you can go to `linter-eslint`'s settings and within "List of scopes to run ESLint on...", add the cursor scope "source.gfm".
In order to see `@eslint/markdown` work its magic within Markdown code blocks in your Atom editor, you can go to `linter-eslint`'s settings and within "List of scopes to run ESLint on...", add the cursor scope "source.gfm".

However, this reports a problem when viewing Markdown which does not have configuration, so you may wish to use the cursor scope "source.embedded.js", but note that `eslint-plugin-markdown` configuration comments and skip directives won't work in this context.
However, this reports a problem when viewing Markdown which does not have configuration, so you may wish to use the cursor scope "source.embedded.js", but note that `@eslint/markdown` configuration comments and skip directives won't work in this context.

## Contributing

```sh
$ git clone https://github.com/eslint/eslint-plugin-markdown.git
$ cd eslint-plugin-markdown
$ git clone https://github.com/eslint/markdown.git
$ cd markdown
nzakas marked this conversation as resolved.
Show resolved Hide resolved
$ npm install
$ npm test
```
Expand Down
113 changes: 113 additions & 0 deletions dist/esm/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
export { plugin as default };
export type Block = import("./types.js").Block;
export type RangeMap = import("./types.js").RangeMap;
export type Node = import("mdast").Node;
export type ParentNode = import("mdast").Parent;
export type CodeNode = import("mdast").Code;
export type HtmlNode = import("mdast").Html;
export type Message = import("eslint").Linter.LintMessage;
export type Range = import("eslint").AST.Range;
declare namespace plugin {
namespace configs {
let recommended: ({
name: string;
plugins: {
markdown: {
meta: {
name: string;
version: string;
};
processors: {
markdown: {
meta: {
name: string;
version: string;
};
preprocess: typeof preprocess;
postprocess: typeof postprocess;
supportsAutofix: boolean;
};
};
configs: {
"recommended-legacy": {
plugins: string[];
overrides: ({
files: string[];
processor: string;
parserOptions?: undefined;
rules?: undefined;
} | {
files: string[];
parserOptions: {
ecmaFeatures: {
impliedStrict: boolean;
};
};
rules: {
"eol-last": string;
"no-undef": string;
"no-unused-expressions": string;
"no-unused-vars": string;
"padded-blocks": string;
strict: string;
"unicode-bom": string;
};
processor?: undefined;
})[];
};
};
};
};
files?: undefined;
processor?: undefined;
languageOptions?: undefined;
rules?: undefined;
} | {
name: string;
files: string[];
processor: string;
plugins?: undefined;
languageOptions?: undefined;
rules?: undefined;
} | {
name: string;
files: string[];
languageOptions: {
parserOptions: {
ecmaFeatures: {
impliedStrict: boolean;
};
};
};
rules: {
"eol-last": string;
"no-undef": string;
"no-unused-expressions": string;
"no-unused-vars": string;
"padded-blocks": string;
strict: string;
"unicode-bom": string;
};
plugins?: undefined;
processor?: undefined;
})[];
}
}
/**
* Extracts lintable code blocks from Markdown text.
* @param {string} text The text of the file.
* @param {string} filename The filename of the file
* @returns {Array<{ filename: string, text: string }>} Source code blocks to lint.
*/
declare function preprocess(text: string, filename: string): Array<{
filename: string;
text: string;
}>;
/**
* Transforms generated messages for output.
* @param {Array<Message[]>} messages An array containing one array of messages
* for each code block returned from `preprocess`.
* @param {string} filename The filename of the file
* @returns {Message[]} A flattened array of messages with mapped locations.
*/
declare function postprocess(messages: Array<Message[]>, filename: string): Message[];
Loading