Skip to content

Commit

Permalink
feat!: Rename to @eslint/markdown (#265)
Browse files Browse the repository at this point in the history
* feat!: Rename to @eslint/markdown

* Update meta.name properties

* Update src/index.js

Co-authored-by: Milos Djermanovic <[email protected]>

* Fix typo

* Update more references

* Update CLA URL

* Fix lint errors

* Remove dist files

---------

Co-authored-by: Milos Djermanovic <[email protected]>
  • Loading branch information
nzakas and mdjermanovic committed Jul 26, 2024
1 parent 923e440 commit e0b5457
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 46 deletions.
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
$ npm install
$ npm test
```
Expand Down
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export default [
ignores: [
"**/examples",
"**/coverage",
"**/tests/fixtures"
"**/tests/fixtures",
"dist"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions examples/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ function App({ name }) {
```

```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
$ npm install
$ cd examples/react
$ npm test

eslint-plugin-markdown/examples/react/README.md
markdown/examples/react/README.md
4:16 error 'name' is missing in props validation react/prop-types

✖ 1 problem (1 error, 0 warnings)
Expand Down
6 changes: 3 additions & 3 deletions examples/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ hello(42 as any);
```

```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
$ npm install
$ cd examples/typescript
$ npm test

eslint-plugin-markdown/examples/typescript/README.md
markdown/examples/typescript/README.md
6:22 error Prefer using the primitive `string` as a type name, rather than the upper-cased `String` @typescript-eslint/no-wrapper-object-types
10:13 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any

Expand Down
19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eslint-plugin-markdown",
"name": "@eslint/markdown",
"version": "5.1.0",
"description": "An ESLint plugin to lint JavaScript in Markdown code fences.",
"description": "The official ESLint language plugin for Markdown",
"license": "MIT",
"author": {
"name": "Brandon Mills",
Expand All @@ -17,11 +17,14 @@
"files": [
"src"
],
"repository": "eslint/eslint-plugin-markdown",
"publishConfig": {
"access": "public"
},
"repository": "eslint/markdown",
"bugs": {
"url": "https://github.com/eslint/eslint-plugin-markdown/issues"
"url": "https://github.com/eslint/markdown/issues"
},
"homepage": "https://github.com/eslint/eslint-plugin-markdown#readme",
"homepage": "https://github.com/eslint/markdown#readme",
"keywords": [
"eslint",
"eslintplugin",
Expand All @@ -32,11 +35,6 @@
"scripts": {
"lint": "eslint .",
"prepare": "node ./npm-prepare.cjs",
"release:generate:latest": "eslint-generate-release",
"release:generate:alpha": "eslint-generate-prerelease alpha",
"release:generate:beta": "eslint-generate-prerelease beta",
"release:generate:rc": "eslint-generate-prerelease rc",
"release:publish": "eslint-publish-release",
"test": "c8 mocha \"tests/**/*.test.js\" --timeout 30000"
},
"devDependencies": {
Expand All @@ -46,7 +44,6 @@
"chai": "^5.1.1",
"eslint": "^9.4.0",
"eslint-config-eslint": "^11.0.0",
"eslint-release": "^3.1.2",
"globals": "^15.1.0",
"mocha": "^10.6.0"
},
Expand Down
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
* @author Brandon Mills
*/

//-----------------------------------------------------------------------------
// Imports
//-----------------------------------------------------------------------------

import { processor } from "./processor.js";

//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------

const rulesConfig = {

// The Markdown parser automatically trims trailing
Expand All @@ -30,7 +38,7 @@ const rulesConfig = {

const plugin = {
meta: {
name: "eslint-plugin-markdown",
name: "@eslint/markdown",
version: "5.1.0" // x-release-please-version
},
processors: {
Expand Down
2 changes: 1 addition & 1 deletion src/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ function postprocess(messages, filename) {

export const processor = {
meta: {
name: "eslint-plugin-markdown/markdown",
name: "@eslint/markdown/markdown",
version: "5.1.0" // x-release-please-version
},
preprocess,
Expand Down
14 changes: 7 additions & 7 deletions tests/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function initFlatESLint(fixtureConfigName, options = {}) {

describe("meta", () => {
it("should export meta property", () => {
assert.deepStrictEqual(plugin.meta, { name: "eslint-plugin-markdown", version: pkg.version });
assert.deepStrictEqual(plugin.meta, { name: "@eslint/markdown", version: pkg.version });
});
});

Expand Down Expand Up @@ -165,7 +165,7 @@ describe("LegacyESLint", () => {
assert.strictEqual(results[0].messages[1].endLine, 8);
});

// https://github.com/eslint/eslint-plugin-markdown/issues/77
// https://github.com/eslint/markdown/issues/77
it("should emit correct line numbers with leading blank line", async () => {
const code = [
"### Heading",
Expand Down Expand Up @@ -277,7 +277,7 @@ describe("LegacyESLint", () => {
assert.strictEqual(results[0].messages[4].column, 2);
});

// https://github.com/eslint/eslint-plugin-markdown/issues/181
// https://github.com/eslint/markdown/issues/181
it("should work when called on nested code blocks in the same file", async () => {

/*
Expand Down Expand Up @@ -350,7 +350,7 @@ describe("LegacyESLint", () => {
assert.strictEqual(results[0].messages[3].line, 15);
});

// https://github.com/eslint/eslint-plugin-markdown/issues/78
// https://github.com/eslint/markdown/issues/78
it("preserves leading empty lines", async () => {
const code = [
"<!-- eslint lines-around-directive: ['error', 'never'] -->",
Expand Down Expand Up @@ -1127,7 +1127,7 @@ describe("FlatESLint", () => {
assert.strictEqual(results[0].messages[1].endLine, 8);
});

// https://github.com/eslint/eslint-plugin-markdown/issues/77
// https://github.com/eslint/markdown/issues/77
it("should emit correct line numbers with leading blank line", async () => {
const code = [
"### Heading",
Expand Down Expand Up @@ -1239,7 +1239,7 @@ describe("FlatESLint", () => {
assert.strictEqual(results[0].messages[4].column, 2);
});

// https://github.com/eslint/eslint-plugin-markdown/issues/181
// https://github.com/eslint/markdown/issues/181
it("should work when called on nested code blocks in the same file", async () => {

/*
Expand Down Expand Up @@ -1312,7 +1312,7 @@ describe("FlatESLint", () => {
assert.strictEqual(results[0].messages[3].line, 15);
});

// https://github.com/eslint/eslint-plugin-markdown/issues/78
// https://github.com/eslint/markdown/issues/78
it("preserves leading empty lines", async () => {
const code = [
"<!-- eslint lines-around-directive: ['error', 'never'] -->",
Expand Down
4 changes: 2 additions & 2 deletions tests/processor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("processor", () => {

describe("meta", () => {
it("should have meta property", () => {
assert.deepStrictEqual(processor.meta, { name: "eslint-plugin-markdown/markdown", version: pkg.version });
assert.deepStrictEqual(processor.meta, { name: "@eslint/markdown/markdown", version: pkg.version });
});
});

Expand Down Expand Up @@ -504,7 +504,7 @@ describe("processor", () => {
].join("\n"));
});

// https://github.com/eslint/eslint-plugin-markdown/issues/76
// https://github.com/eslint/markdown/issues/76
it("should insert comments inside list items", () => {
const code = [
"* List item followed by a blank line",
Expand Down

0 comments on commit e0b5457

Please sign in to comment.