Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(deps-dev): bump markdownlint from 0.36.1 to 0.37.3#135

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JoyceZhu merged 15 commits intomainfromdependabot/npm_and_yarn/markdownlint-0.37.3
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
cce98aa
chore(deps-dev): bump markdownlint from 0.36.1 to 0.37.3
dependabot[bot]Jan 6, 2025
62e3669
Progress converting from CommonJS -> ESM
JoyceZhuJan 10, 2025
a18dbdf
progress
JoyceZhuJan 10, 2025
354ceaa
version update
JoyceZhuJan 16, 2025
84aebbc
progress?...
JoyceZhuJan 17, 2025
671c049
Fix missing trailing `.js` and following tests
JoyceZhuJan 17, 2025
a03d501
Merge branch 'main' into dependabot/npm_and_yarn/markdownlint-0.37.3
JoyceZhuJan 17, 2025
239b15a
Fix `npm run test`
JoyceZhuJan 17, 2025
db5cd52
Test fixes, begin to clean up
JoyceZhuJan 17, 2025
d6d4f78
re-add space
JoyceZhuJan 17, 2025
3bd1c70
Update `README` with ESM examples
JoyceZhuJan 17, 2025
7c5aef4
remove outdated WIP comment
JoyceZhuJan 17, 2025
3a2ce49
Fix test
JoyceZhuJan 22, 2025
d86cd37
Merge branch 'main' into dependabot/npm_and_yarn/markdownlint-0.37.3
JoyceZhuJan 22, 2025
3ae5b70
Update to version 0.2.0
JoyceZhuJan 22, 2025
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
18 changes: 0 additions & 18 deletions.eslintrc.js
View file
Open in desktop

This file was deleted.

24 changes: 24 additions & 0 deletions.eslintrc.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 2020
},
"env": {
"es6": true,
"node": true,
"jest": true
},
"plugins": ["github"],
"extends": ["plugin:github/recommended"],
"rules": {
"filenames/match-regex": "off",
"i18n-text/no-en": "off",
"import/extensions": ["error", { "js": "ignorePackages"}],
"import/no-unresolved": [
"error",
{
"ignore": ["^markdownlint/.+"]
}
]
}
}
12 changes: 0 additions & 12 deletions.markdownlint-cli2.cjs
View file
Open in desktop

This file was deleted.

15 changes: 15 additions & 0 deletions.markdownlint-cli2.mjs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
import { init } from "./index.js";

const configOptions = await init({
Copy link
Contributor

@khiga8khiga8Jan 21, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I was about to recommend pointing of our projects to this branch to make sure things run as expected with this big change/new setup, but it seems like this basically acts like a test? Would it be worth testing this change out in one of our larger repos that uses this project by pointing to this branch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah, my understanding after reading for awhile is that we only have this file/usemarkdownlint-cli2 so we canrun our own linting setup against the files in this repo (meta-testing, I guess).

default: false,
"heading-increment": true,
"no-alt-text": true,
"single-h1": true,
"no-emphasis-as-heading": true,
"first-line-heading": true,
});
const options = {
config: configOptions,
customRules: ["./index.js"],
};
export default options;
2 changes: 1 addition & 1 deletion.nvmrc
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
14
18
9 changes: 9 additions & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
# Changelog

## 0.2.0

* BREAKING change: Convert to ECMAScript modules (ESM)

## 0.1.0

* Initial release
34 changes: 20 additions & 14 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,10 +22,10 @@ See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--ali

**Important**: We support the use of `markdownlint` through [`markdownlint-cli2`](https://github.com/DavidAnson/markdownlint-cli2) instead of `markdownlint-cli` for compatibility with the [`vscode-markdownlint`](https://github.com/DavidAnson/vscode-markdownlint) plugin.

1. Create a `.markdownlint-cli2.cjs` file in the root of your repository.
1. Create a `.markdownlint-cli2.mjs` file in the root of your repository.

```bash
touch .markdownlint-cli2.cjs
touch .markdownlint-cli2.mjs
```

2. Install packages.
Expand All@@ -44,36 +44,39 @@ See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--ali
}
```

4. Edit `.markdownlint-cli2.cjs` file to suit your needs. Start with
4. Edit `.markdownlint-cli2.mjs` file to suit your needs. Start with

```js
const options = require('@github/markdownlint-github').init()
module.exports = {
config:options,
import configOptions, {init} from "@github/markdownlint-github"
const options = {
config:init(),
customRules: ["@github/markdownlint-github"],
outputFormatters: [
[ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] // ensures the error message includes a link to the rule documentation
]
}
export default options
```

Or, you can also pass in configuration options that you wish to override the default. Read more at [Customizing configurations](#customizing-configurations).
Or, you can also pass in configuration options that you wish to override the default. Read more at [Customizing configurations](#customizing-configurations).
This looks like:

```js
const options = require('@github/markdownlint-github').init({
import configOptions, {init} from "@github/markdownlint-github"
const overriddenOptions = init({
'fenced-code-language': false, // Custom overrides
})
module.exports = {
config:options,
const options = {
config:overriddenOptions,
customRules: ["@github/markdownlint-github"],
outputFormatters: [
[ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ]
]
}
export default options
```

5. Install the [`vscode-markdownlint`](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) plugin to ensure `markdownlint` violations are surfaced in the file. This plugin should flag rules based off your `.markdownlint-cli2.cjs` configuration. When you make edits to your configuration, you will need to reload the VSCode window (`Ctrl+Shift+P` -> `Reload Window`) to ensure the extension syncs. If your project runs on Codespaces, consider adding this extension to your `.devcontainer/devcontainer.json` so that this extension is installed to new Codespaces by default.
5. Install the [`vscode-markdownlint`](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) plugin to ensure `markdownlint` violations are surfaced in the file. This plugin should flag rules based off your `.markdownlint-cli2.mjs` configuration. When you make edits to your configuration, you will need to reload the VSCode window (`Ctrl+Shift+P` -> `Reload Window`) to ensure the extension syncs. If your project runs on Codespaces, consider adding this extension to your `.devcontainer/devcontainer.json` so that this extension is installed to new Codespaces by default.

### Customizing configurations

Expand All@@ -89,13 +92,15 @@ To review configurations supported by `markdownlint`, see [`markdownlint-cli2` c

You may write custom rules within your repository. Follow the [custom rules guide in `markdownlint`](https://github.com/DavidAnson/markdownlint/blob/main/doc/CustomRules.md) to write your rule.

The rule will need to be enabled in the configuration. For instance, if you introduce `some-rule.js` with the name "some-rule", you must set the path of the custom rule in the `.markdownlint-cli2.cjs` file:
The rule will need to be enabled in the configuration. For instance, if you introduce `some-rule.js` with the name "some-rule", you must set the path of the custom rule in the `.markdownlint-cli2.mjs` file:

```js
module.exports = require('@github/markdownlint-github').init({
import configOptions, {init} from "@github/markdownlint-github"
const options = init({
"some-rule": true,
customRules: ["@github/markdownlint-github", "some-rule.js"],
})
export default options
```

See [`markdownlint-cli2` configuration](https://github.com/DavidAnson/markdownlint-cli2#configuration).
Expand All@@ -104,7 +109,8 @@ Consider upstreaming any rules you find useful as proposals to this repository.

## License

This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE.txt) for the full terms.
This project is licensed under the terms of the MIT open source license. Please
refer to [the MIT license](./LICENSE.txt) for the full terms.

## Maintainers

Expand Down
32 changes: 19 additions & 13 deletionsindex.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
const _ = require("lodash");
import { readFile } from "fs/promises";
import _ from "lodash-es";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

regular lodash is synchronous

import { githubMarkdownLint } from "./src/rules/index.js";

const accessibilityRules = require("./style/accessibility.json");
const base = require("./style/base.json");
const gitHubCustomRules = require("./src/rules/index").rules;
const offByDefault = ["no-empty-alt-text"];

module.exports = [...gitHubCustomRules];
export async function init(consumerConfig) {
// left overwrites right
const accessibilityRules = JSON.parse(
await readFile(new URL("./style/accessibility.json", import.meta.url)),
);

const offByDefault = ["no-empty-alt-text"];
const base = JSON.parse(
await readFile(new URL("./style/base.json", import.meta.url)),
);

for (const rule ofgitHubCustomRules) {
const ruleName = rule.names[1];
base[ruleName] = offByDefault.includes(ruleName) ? false : true;
}
for (const rule ofgithubMarkdownLint) {
const ruleName = rule.names[1];
base[ruleName] = offByDefault.includes(ruleName) ? false : true;
}

module.exports.init = function init(consumerConfig) {
// left overwrites right
return _.defaultsDeep(consumerConfig, accessibilityRules, base);
};
}

export default githubMarkdownLint;
4 changes: 4 additions & 0 deletionsjest.config.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
{
"transform": {
}
}
68 changes: 27 additions & 41 deletionspackage-lock.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

14 changes: 9 additions & 5 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
{
"name": "@github/markdownlint-github",
"version": "0.1.0",
"version": "0.2.0",
"description": "An opinionated collection of markdownlint rules used by GitHub.",
"main": "index.js",
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=18"
},
"directories": {
"test": "test"
},
"scripts": {
"publish": "npm publish --access public --@github:registry=https://registry.npmjs.org",
"test": "npm run lint && jest",
"test": "npm run lint &&NODE_OPTIONS=--experimental-vm-modulesjest",
"lint": "markdownlint-cli2 \"**/*.{md,mdx}\" \"!node_modules\" \"!docs/rules\" \"!test/example.md\" && eslint .",
"lint:fix": "npm run lint -- --fix"
},
"dependencies": {
"lodash": "^4.17.15"
"lodash-es": "^4.17.15"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-plugin-github": "^5.0.1",
"jest": "^29.5.0",
"markdownlint": "^0.36.1",
"markdownlint": "^0.37.3",
"markdownlint-cli2": "^0.17.1"
},
"repository": {
Expand Down
4 changes: 1 addition & 3 deletionssrc/helpers/strip-and-downcase-text.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
/* Downcase and strip extra whitespaces and punctuation */
function stripAndDowncaseText(text) {
exportfunction stripAndDowncaseText(text) {
return text
.toLowerCase()
.replace(/[.,/#!$%^&*;:{}=\-_`~()]/g, "")
.replace(/\s+/g, " ")
.trim();
}

module.exports = { stripAndDowncaseText };
Loading

[8]ページ先頭

©2009-2025 Movatter.jp