diff --git a/.eslintrc.js b/.eslintrc.js index ec21a0b287d7c8..e82e1afcae2b6b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -53,11 +53,11 @@ module.exports = { overrides: [ { files: [ - 'doc/api/esm.md', - 'doc/api/module.md', - 'doc/api/modules.md', - 'doc/api/packages.md', - 'doc/api/wasi.md', + 'doc/api/esm.md/*.js', + 'doc/api/module.md/*.js', + 'doc/api/modules.md/*.js', + 'doc/api/packages.md/*.js', + 'doc/api/wasi.md/*.js', 'test/es-module/test-esm-type-flag.js', 'test/es-module/test-esm-type-flag-alias.js', '*.mjs', @@ -67,6 +67,10 @@ module.exports = { }, { files: ['**/*.md'], + processor: 'markdown/markdown', + }, + { + files: ['**/*.md/*.js'], parserOptions: { ecmaFeatures: { impliedStrict: true } }, rules: { strict: 'off' }, }, diff --git a/Makefile b/Makefile index 0fa52f331f7802..72c0d815361423 100644 --- a/Makefile +++ b/Makefile @@ -1222,7 +1222,7 @@ lint-md: lint-js-doc | tools/.mdlintstamp LINT_JS_TARGETS = .eslintrc.js benchmark doc lib test tools run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \ - --report-unused-disable-directives --ext=$(EXTENSIONS) $(LINT_JS_TARGETS) + --report-unused-disable-directives $(LINT_JS_TARGETS) run-lint-js-fix = $(run-lint-js) --fix .PHONY: lint-js-fix @@ -1233,8 +1233,6 @@ lint-js-fix: .PHONY: lint-js-doc # Note that on the CI `lint-js-ci` is run instead. # Lints the JavaScript code with eslint. -lint-js lint-js-fix: EXTENSIONS=.js,.mjs,.md -lint-js-doc: EXTENSIONS=.md lint-js lint-js-doc: @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ echo "Skipping $@ (no crypto)"; \ @@ -1247,7 +1245,7 @@ jslint: lint-js $(warning Please use lint-js instead of jslint) run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \ - --report-unused-disable-directives --ext=.js,.mjs,.md -f tap \ + --report-unused-disable-directives -f tap \ -o test-eslint.tap $(LINT_JS_TARGETS) .PHONY: lint-js-ci diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/README.md b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/README.md index 22f5099b65cccd..fd8767b753596c 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/README.md +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/README.md @@ -1,36 +1,232 @@ # eslint-plugin-markdown -![Screenshot](screenshot.png) +[![npm Version](https://img.shields.io/npm/v/eslint-plugin-markdown.svg)](https://www.npmjs.com/package/eslint-plugin-markdown) +[![Build Status](https://img.shields.io/github/workflow/status/eslint/eslint-plugin-markdown/CI/main.svg)](https://github.com/eslint/eslint-plugin-markdown/actions) -An [ESLint](http://eslint.org/) plugin to lint JavaScript in Markdown. +Lint JS, JSX, TypeScript, and more inside Markdown. -Supported extensions are `.markdown`, `.mdown`, `.mkdn`, and `.md`. +A JS code snippet in a Markdown editor has red squiggly underlines. A tooltip explains the problem. ## Usage -Install the plugin: +### Installing + +Install the plugin alongside ESLint v6 or greater: ```sh npm install --save-dev eslint eslint-plugin-markdown ``` -Add it to your `.eslintrc`: +### Configuring -```json -{ - "plugins": [ - "markdown" +Extending the `plugin:markdown/recommended` config will enable the Markdown processor on all `.md` files: + +```js +// .eslintrc.js +module.exports = { + extends: "plugin:markdown/recommended" +}; +``` + +#### Advanced Configuration + +Add the plugin to your `.eslintrc` and use the `processor` option in an `overrides` entry to enable the plugin's `markdown/markdown` processor on Markdown files. +Each fenced code block inside a Markdown document has a virtual filename appended to the Markdown file's path. +The virtual filename's extension will match the fenced code block's syntax tag, so for example, ```js code blocks in README.md would match README.md/*.js. +[`overrides` glob patterns](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) for these virtual filenames can customize configuration for code blocks without affecting regular code. +For more information on configuring processors, refer to the [ESLint documentation](https://eslint.org/docs/user-guide/configuring#specifying-processor). + +```js +// .eslintrc.js +module.exports = { + // 1. Add the plugin. + plugins: ["markdown"], + overrides: [ + { + // 2. Enable the Markdown processor for all .md files. + files: ["**/*.md"], + processor: "markdown/markdown" + }, + { + // 3. Optionally, customize the configuration ESLint uses for ```js + // fenced code blocks inside .md files. + files: ["**/*.md/*.js"], + // ... + rules: { + // ... + } + } ] -} +}; +``` + +#### Frequently-Disabled Rules + +Some rules that catch mistakes in regular code are less helpful in documentation. +For example, `no-undef` would flag variables that are declared outside of a code snippet because they aren't relevant to the example. +The `plugin:markdown/recommended` config disables these rules in Markdown files: + +- [`no-undef`](https://eslint.org/docs/rules/no-undef) +- [`no-unused-expressions`](https://eslint.org/docs/rules/no-unused-expressions) +- [`no-unused-vars`](https://eslint.org/docs/rules/no-unused-vars) +- [`padded-blocks`](https://eslint.org/docs/rules/padded-blocks) + +Use [`overrides` glob patterns](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) to disable more rules just for Markdown code blocks: + +```js +module.exports = { + // ... + overrides: [ + // ... + { + // 1. Target ```js code blocks in .md files. + files: ["**/*.md/*.js"], + rules: { + // 2. Disable other rules. + "no-console": "off", + "import/no-unresolved": "off" + } + } + ] +}; +``` + +#### Strict Mode + +`"use strict"` directives in every code block would be annoying. +The `plugin:markdown/recommended` config enables the [`impliedStrict` parser option](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) and disables the [`strict` rule](https://eslint.org/docs/rules/strict) in Markdown files. +This opts into strict mode parsing without repeated `"use strict"` directives. + +#### Unsatisfiable Rules + +Markdown code blocks are not real files, so ESLint's file-format rules do not apply. +The `plugin:markdown/recommended` config disables these rules in Markdown files: + +- [`eol-last`](https://eslint.org/docs/rules/eol-last): The Markdown parser trims trailing newlines from code blocks. +- [`unicode-bom`](https://eslint.org/docs/rules/unicode-bom): Markdown code blocks do not have Unicode Byte Order Marks. + +#### Migrating from `eslint-plugin-markdown` v1 + +`eslint-plugin-markdown` v1 used an older version of ESLint's processor API. +The Markdown processor automatically ran on `.md`, `.mkdn`, `.mdown`, and `.markdown` files, and it only extracted fenced code blocks marked with `js`, `javascript`, `jsx`, or `node` syntax. +Configuration specifically for fenced code blocks went inside an `overrides` entry with a `files` pattern matching the containing Markdown document's filename that applied to all fenced code blocks inside the file. + +```js +// .eslintrc.js for eslint-plugin-markdown v1 +module.exports = { + plugins: ["markdown"], + overrides: [ + { + files: ["**/*.md"], + // In v1, configuration for fenced code blocks went inside an + // `overrides` entry with a .md pattern, for example: + parserOptions: { + ecmaFeatures: { + impliedStrict: true + } + }, + rules: { + "no-console": "off" + } + } + ] +}; +``` + +[RFC3](https://github.com/eslint/rfcs/blob/master/designs/2018-processors-improvements/README.md) designed a new processor API to remove these limitations, and the new API was [implemented](https://github.com/eslint/eslint/pull/11552) as part of ESLint v6. +`eslint-plugin-markdown` v2 uses this new API. + +```bash +$ npm install --save-dev eslint@latest eslint-plugin-markdown@latest +``` + +All of the Markdown file extensions that were previously hard-coded are now fully configurable in `.eslintrc.js`. +Use the new `processor` option to apply the `markdown/markdown` processor on any Markdown documents matching a `files` pattern. +Each fenced code block inside a Markdown document has a virtual filename appended to the Markdown file's path. +The virtual filename's extension will match the fenced code block's syntax tag, so for example, ```js code blocks in README.md would match README.md/*.js. + +```js +// eslintrc.js for eslint-plugin-markdown v2 +module.exports = { + plugins: ["markdown"], + overrides: [ + { + // In v2, explicitly apply eslint-plugin-markdown's `markdown` + // processor on any Markdown files you want to lint. + files: ["**/*.md"], + processor: "markdown/markdown" + }, + { + // In v2, configuration for fenced code blocks is separate from the + // containing Markdown file. Each code block has a virtual filename + // appended to the Markdown file's path. + files: ["**/*.md/*.js"], + // Configuration for fenced code blocks goes with the override for + // the code block's virtual filename, for example: + parserOptions: { + ecmaFeatures: { + impliedStrict: true + } + }, + rules: { + "no-console": "off" + } + } + ] +}; +``` + +If you need to precisely mimic the behavior of v1 with the hard-coded Markdown extensions and fenced code block syntaxes, you can use those as glob patterns in `overrides[].files`: + +```js +// eslintrc.js for v2 mimicking v1 behavior +module.exports = { + plugins: ["markdown"], + overrides: [ + { + files: ["**/*.{md,mkdn,mdown,markdown}"], + processor: "markdown/markdown" + }, + { + files: ["**/*.{md,mkdn,mdown,markdown}/*.{js,javascript,jsx,node}"] + // ... + } + ] +}; ``` -Run ESLint on `.md` files: +### Running + +#### ESLint v7 + +You can run ESLint as usual and do not need to use the `--ext` option. +ESLint v7 [automatically lints file extensions specified in `overrides[].files` patterns in config files](https://github.com/eslint/rfcs/blob/0253e3a95511c65d622eaa387eb73f824249b467/designs/2019-additional-lint-targets/README.md). + +#### ESLint v6 + +Use the [`--ext` option](https://eslint.org/docs/user-guide/command-line-interface#ext) to include `.js` and `.md` extensions in ESLint's file search: ```sh -eslint --ext md . +eslint --ext js,md . ``` -It will lint `js`, `javascript`, `jsx`, or `node` [fenced code blocks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) in your Markdown documents: +### Autofixing + +With this plugin, [ESLint's `--fix` option](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some issues in your Markdown fenced code blocks. +To enable this, pass the `--fix` flag when you run ESLint: + +```bash +eslint --fix . +``` + +## What Gets Linted? + +With this plugin, ESLint will lint [fenced code blocks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) in your Markdown documents: ````markdown ```js @@ -39,7 +235,9 @@ var answer = 6 * 7; console.log(answer); ``` -```JavaScript +Here is some regular Markdown text that will be ignored. + +```js // This also gets linted /* eslint quotes: [2, "double"] */ @@ -51,23 +249,24 @@ hello(); ``` ```jsx -// This gets linted too +// This can be linted too if you add `.jsx` files to `overrides` in ESLint v7 +// or pass `--ext jsx` in ESLint v6. var div =
; ``` - -```node -// And this -console.log(process.version); -``` ```` -Blocks that don't specify either `js`, `javascript`, `jsx`, or `node` syntax are ignored: +Blocks that don't specify a syntax are ignored: ````markdown ``` This is plain text and doesn't get linted. ``` +```` + +Unless a fenced code block's syntax appears as a file extension in `overrides[].files` in ESLint v7, it will be ignored. +If using ESLint v6, you must also include the extension with the `--ext` option. +````markdown ```python print("This doesn't get linted either.") ``` @@ -75,7 +274,9 @@ print("This doesn't get linted either.") ## Configuration Comments -The processor will convert HTML comments immediately preceding a code block into JavaScript block comments and insert them at the beginning of the source code that it passes to ESLint. This permits configuring ESLint via configuration comments while keeping the configuration comments themselves hidden when the markdown is rendered. Comment bodies are passed through unmodified, so the plugin supports any [configuration comments](http://eslint.org/docs/user-guide/configuring) supported by ESLint itself. +The processor will convert HTML comments immediately preceding a code block into JavaScript block comments and insert them at the beginning of the source code that it passes to ESLint. +This permits configuring ESLint via configuration comments while keeping the configuration comments themselves hidden when the markdown is rendered. +Comment bodies are passed through unmodified, so the plugin supports any [configuration comments](http://eslint.org/docs/user-guide/configuring) supported by ESLint itself. This example enables the `browser` environment, disables the `no-alert` rule, and configures the `quotes` rule to prefer single quotes: @@ -110,9 +311,12 @@ alert("Hello, world!"); ``` ```` -## Skipping Blocks +### Skipping Blocks -Sometimes it can be useful to have code blocks marked with `js` even though they don't contain valid JavaScript syntax, such as commented JSON blobs that need `js` syntax highlighting. Standard `eslint-disable` comments only silence rule reporting, but ESLint still reports any syntax errors it finds. In cases where a code block should not even be parsed, insert a non-standard `` comment before the block, and this plugin will hide the following block from ESLint. Neither rule nor syntax errors will be reported. +Sometimes it can be useful to have code blocks marked with `js` even though they don't contain valid JavaScript syntax, such as commented JSON blobs that need `js` syntax highlighting. +Standard `eslint-disable` comments only silence rule reporting, but ESLint still reports any syntax errors it finds. +In cases where a code block should not even be parsed, insert a non-standard `` comment before the block, and this plugin will hide the following block from ESLint. +Neither rule nor syntax errors will be reported. ````markdown There are comments in this JSON, so we use `js` syntax for better @@ -132,91 +336,19 @@ console.log("This code block is linted normally."); ``` ```` -## Fix issues automatically - -This plugin can attempt to fix some of the issues automatically using [`fix` ESLint option](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems). This option instructs ESLint to try to fix as many issues as possible. To enable this option you can add `--fix` to your ESLint call, for example: - -```bash -eslint --fix --ext md . -``` - -## Unsatisfiable Rules - -Since code blocks are not files themselves but embedded inside a Markdown document, some rules do not apply to Markdown code blocks, and messages from these rules are automatically suppressed: - -- `eol-last` -- `unicode-bom` - -### Project or directory-wide overrides for code snippets - -Given that code snippets often lack full context, and adding full context -through configuration comments may be too cumbersome to apply for each snippet, -one may wish to instead set defaults for all one's JavaScript snippets in a -manner that applies to all Markdown files within your project (or a specific -directory). +## Editor Integrations -ESLint allows a configuration property `overrides` which has a `files` -property which accepts a -[glob pattern](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns), allowing you to designate files (such as all `md` files) whose rules will -be overridden. +### VSCode -The following example shows the disabling of a few commonly problematic rules -for code snippets. It also points to the fact that some rules -(e.g., `padded-blocks`) may be more appealing for disabling given that -one may wish for documentation to be more liberal in providing padding for -readability. - -```js -// .eslintrc.json -{ - // ... - "overrides": [{ - "files": ["**/*.md"], - "rules": { - "no-undef": "off", - "no-unused-vars": "off", - "no-console": "off", - "padded-blocks": "off" - } - }] -} -``` - -#### Overriding `strict` - -The `strict` rule is technically satisfiable inside of Markdown code blocks, but writing a `"use strict"` directive at the top of every code block is tedious and distracting. We recommend a glob pattern for `.md` files to disable `strict` and enable the `impliedStrict` [parser option](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) so the code blocks still parse in strict mode: - -```js -// .eslintrc.json -{ - // ... - "overrides": [{ - "files": ["**/*.md"], - "parserOptions": { - "ecmaFeatures": { - "impliedStrict": true - } - }, - "rules": { - "strict": "off" - } - }] -} -``` +[`vscode-eslint`](https://github.com/microsoft/vscode-eslint) has built-in support for the Markdown processor. -## Tips for use with Atom linter-eslint +### Atom -The [linter-eslint](https://atom.io/packages/linter-eslint) package allows for -linting within the [Atom IDE](https://atom.io/). +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-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". -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-plugin-markdown` configuration comments and skip directives won't work in this context. ## Contributing diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/index.js b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/index.js index 59fbcd08d8a277..1638f11ee3c12b 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/index.js +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/index.js @@ -5,6 +5,4 @@ "use strict"; -// https://github.com/mysticatea/eslint-plugin-node/issues/193 -// eslint-disable-next-line node/no-unpublished-require module.exports = require("./lib"); diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/index.js b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/index.js index e27aa162f98cb0..d66a7ddda6f6c2 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/index.js +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/index.js @@ -8,10 +8,53 @@ const processor = require("./processor"); module.exports = { + configs: { + recommended: { + plugins: ["markdown"], + overrides: [ + { + files: ["*.md"], + processor: "markdown/markdown" + }, + { + files: ["**/*.md/**"], + parserOptions: { + ecmaFeatures: { + + // Adding a "use strict" directive at the top of + // every code block is tedious and distracting, so + // opt into strict mode parsing without the + // directive. + impliedStrict: true + } + }, + rules: { + + // The Markdown parser automatically trims trailing + // newlines from code blocks. + "eol-last": "off", + + // In code snippets and examples, these rules are often + // counterproductive to clarity and brevity. + "no-undef": "off", + "no-unused-expressions": "off", + "no-unused-vars": "off", + "padded-blocks": "off", + + // Adding a "use strict" directive at the top of every + // code block is tedious and distracting. The config + // opts into strict mode parsing without the directive. + strict: "off", + + // The processor will not receive a Unicode Byte Order + // Mark from the Markdown parser. + "unicode-bom": "off" + } + } + ] + } + }, processors: { - ".markdown": processor, - ".mdown": processor, - ".mkdn": processor, - ".md": processor + markdown: processor } }; diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/processor.js b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/processor.js index 594efc8049d2d4..41f6f7a280e61f 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/processor.js +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/processor.js @@ -5,11 +5,9 @@ "use strict"; -const assign = require("object-assign"); const unified = require("unified"); const remarkParse = require("remark-parse"); -const SUPPORTED_SYNTAXES = ["js", "javascript", "node", "jsx"]; const UNSATISFIABLE_RULES = [ "eol-last", // The Markdown parser strips trailing newlines in code fences "unicode-bom" // Code blocks will begin in the middle of Markdown files @@ -47,7 +45,7 @@ function traverse(node, callbacks, parent) { function getComment(html) { const commentStart = ""; - const regex = /^(eslint\b|global\s)/; + const regex = /^(eslint\b|global\s)/u; if ( html.slice(0, commentStart.length) !== commentStart || @@ -67,7 +65,7 @@ function getComment(html) { // Before a code block, blockquote characters (`>`) are also considered // "whitespace". -const leadingWhitespaceRegex = /^[>\s]*/; +const leadingWhitespaceRegex = /^[>\s]*/u; /** * Gets the offset for the first column of the node's first line in the @@ -116,7 +114,6 @@ function getIndentText(text, node) { * suffix of the corresponding line in the Markdown code block. There are no * differences within the line, so the mapping need only provide the offset * delta at the beginning of each line. - * * @param {string} text The text of the file. * @param {ASTNode} node A Markdown code block AST node. * @param {comments} comments List of configuration comment strings that will be @@ -224,7 +221,7 @@ function preprocess(text) { code(node, parent) { const comments = []; - if (node.lang && SUPPORTED_SYNTAXES.indexOf(node.lang.split(" ")[0].toLowerCase()) >= 0) { + if (node.lang) { let index = parent.children.indexOf(node) - 1; let previousNode = parent.children[index]; @@ -244,20 +241,24 @@ function preprocess(text) { previousNode = parent.children[index]; } - blocks.push(assign({}, node, { + blocks.push({ + ...node, baseIndentText: getIndentText(text, node), comments, rangeMap: getBlockRangeMap(text, node, comments) - })); + }); } } }); - return blocks.map(block => [ - ...block.comments, - block.value, - "" - ].join("\n")); + return blocks.map((block, index) => ({ + filename: `${index}.${block.lang.trim().split(" ")[0]}`, + text: [ + ...block.comments, + block.value, + "" + ].join("\n") + })); } /** @@ -278,7 +279,6 @@ function adjustBlock(block) { return function adjustMessage(message) { const lineInCode = message.line - leadingCommentLines; - const endLine = message.endLine - leadingCommentLines; if (lineInCode < 1) { return null; @@ -286,10 +286,13 @@ function adjustBlock(block) { const out = { line: lineInCode + blockStart, - endLine: endLine ? endLine + blockStart : endLine, column: message.column + block.position.indent[lineInCode - 1] - 1 }; + if (Number.isInteger(message.endLine)) { + out.endLine = message.endLine - leadingCommentLines + blockStart; + } + const adjustedFix = {}; if (message.fix) { @@ -308,11 +311,11 @@ function adjustBlock(block) { // Apply the mapping delta for this range. return range + block.rangeMap[i - 1].md; }), - text: message.fix.text.replace(/\n/g, `\n${block.baseIndentText}`) + text: message.fix.text.replace(/\n/gu, `\n${block.baseIndentText}`) }; } - return assign({}, message, out, adjustedFix); + return { ...message, ...out, ...adjustedFix }; }; } diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/package.json b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/package.json index 33ac8cbb18d4b0..493af337f1a5eb 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/package.json +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/package.json @@ -8,7 +8,6 @@ }, "bundleDependencies": false, "dependencies": { - "object-assign": "^4.0.1", "remark-parse": "^5.0.0", "unified": "^6.1.2" }, @@ -16,15 +15,16 @@ "description": "An ESLint plugin to lint JavaScript in Markdown code fences.", "devDependencies": { "chai": "^4.2.0", - "eslint": "^5.16.0", - "eslint-config-eslint": "^5.0.1", - "eslint-plugin-node": "^6.0.1", - "eslint-release": "^1.2.0", + "eslint": "^6.8.0", + "eslint-config-eslint": "^6.0.0", + "eslint-plugin-jsdoc": "^15.9.5", + "eslint-plugin-node": "^9.0.0", + "eslint-release": "^3.1.2", "mocha": "^6.2.2", "nyc": "^14.1.1" }, "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.12.0 || >= 12.0.0" }, "files": [ "index.js", @@ -42,6 +42,9 @@ "license": "MIT", "main": "index.js", "name": "eslint-plugin-markdown", + "peerDependencies": { + "eslint": ">=6.0.0" + }, "repository": { "type": "git", "url": "git+https://github.com/eslint/eslint-plugin-markdown.git" @@ -51,10 +54,11 @@ "generate-betarelease": "eslint-generate-prerelease beta", "generate-rcrelease": "eslint-generate-prerelease rc", "generate-release": "eslint-generate-release", - "lint": "eslint .", + "lint": "eslint --ext js,md .", + "prepare": "node ./npm-prepare.js", "publish-release": "eslint-publish-release", "test": "npm run lint && npm run test-cov", - "test-cov": "nyc _mocha -- -c tests/lib/**/*.js" + "test-cov": "nyc _mocha -- -c tests/{examples,lib}/**/*.js" }, - "version": "1.0.2" + "version": "2.0.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/object-assign/index.js b/tools/node_modules/eslint/node_modules/object-assign/index.js deleted file mode 100644 index 0930cf8890b9af..00000000000000 --- a/tools/node_modules/eslint/node_modules/object-assign/index.js +++ /dev/null @@ -1,90 +0,0 @@ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; diff --git a/tools/node_modules/eslint/node_modules/object-assign/license b/tools/node_modules/eslint/node_modules/object-assign/license deleted file mode 100644 index 654d0bfe943437..00000000000000 --- a/tools/node_modules/eslint/node_modules/object-assign/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/object-assign/package.json b/tools/node_modules/eslint/node_modules/object-assign/package.json deleted file mode 100644 index 56c2a93c0a97bf..00000000000000 --- a/tools/node_modules/eslint/node_modules/object-assign/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/object-assign/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "ES2015 `Object.assign()` ponyfill", - "devDependencies": { - "ava": "^0.16.0", - "lodash": "^4.16.4", - "matcha": "^0.7.0", - "xo": "^0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/object-assign#readme", - "keywords": [ - "object", - "assign", - "extend", - "properties", - "es2015", - "ecmascript", - "harmony", - "ponyfill", - "prollyfill", - "polyfill", - "shim", - "browser" - ], - "license": "MIT", - "name": "object-assign", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/object-assign.git" - }, - "scripts": { - "bench": "matcha bench.js", - "test": "xo && ava" - }, - "version": "4.1.1" -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/object-assign/readme.md b/tools/node_modules/eslint/node_modules/object-assign/readme.md deleted file mode 100644 index 1be09d35c776cc..00000000000000 --- a/tools/node_modules/eslint/node_modules/object-assign/readme.md +++ /dev/null @@ -1,61 +0,0 @@ -# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) - -> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) - - -## Use the built-in - -Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), -support `Object.assign()` :tada:. If you target only those environments, then by all -means, use `Object.assign()` instead of this package. - - -## Install - -``` -$ npm install --save object-assign -``` - - -## Usage - -```js -const objectAssign = require('object-assign'); - -objectAssign({foo: 0}, {bar: 1}); -//=> {foo: 0, bar: 1} - -// multiple sources -objectAssign({foo: 0}, {bar: 1}, {baz: 2}); -//=> {foo: 0, bar: 1, baz: 2} - -// overwrites equal keys -objectAssign({foo: 0}, {foo: 1}, {foo: 2}); -//=> {foo: 2} - -// ignores null and undefined sources -objectAssign({foo: 0}, null, {bar: 1}, undefined); -//=> {foo: 0, bar: 1} -``` - - -## API - -### objectAssign(target, [source, ...]) - -Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. - - -## Resources - -- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) - - -## Related - -- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/tools/node_modules/eslint/node_modules/string-width/index.js b/tools/node_modules/eslint/node_modules/string-width/index.js index 9b02b70c5ba1c6..f4d261a96a099e 100644 --- a/tools/node_modules/eslint/node_modules/string-width/index.js +++ b/tools/node_modules/eslint/node_modules/string-width/index.js @@ -8,13 +8,13 @@ const stringWidth = string => { return 0; } - string = string.replace(emojiRegex(), ' '); + string = stripAnsi(string); if (string.length === 0) { return 0; } - string = stripAnsi(string); + string = string.replace(emojiRegex(), ' '); let width = 0; diff --git a/tools/node_modules/eslint/node_modules/string-width/package.json b/tools/node_modules/eslint/node_modules/string-width/package.json index fe19cc9ea913e2..e2b884cb399042 100644 --- a/tools/node_modules/eslint/node_modules/string-width/package.json +++ b/tools/node_modules/eslint/node_modules/string-width/package.json @@ -61,5 +61,5 @@ "scripts": { "test": "xo && ava && tsd" }, - "version": "4.2.1" + "version": "4.2.2" } \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 68ccf4d1377d1d..8a61c471dc1a55 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -19,7 +19,7 @@ "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", - "eslint-plugin-markdown": "^1.0.2", + "eslint-plugin-markdown": "^2.0.0", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", diff --git a/vcbuild.bat b/vcbuild.bat index 4316658bb484b7..6b618084e33bcf 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -689,7 +689,7 @@ goto lint-js if not defined lint_js goto lint-md-build if not exist tools\node_modules\eslint goto no-lint echo running lint-js -%node_exe% tools\node_modules\eslint\bin\eslint.js --cache --report-unused-disable-directives --rule "linebreak-style: 0" --ext=.js,.mjs,.md .eslintrc.js benchmark doc lib test tools +%node_exe% tools\node_modules\eslint\bin\eslint.js --cache --report-unused-disable-directives --rule "linebreak-style: 0" .eslintrc.js benchmark doc lib test tools goto lint-md-build :no-lint