mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Add .mjs to linting, switch from eslint-plugin-node (no longer maintained) to eslint-plugin-n, update suppressions.
This commit is contained in:
parent
a2b1353db5
commit
0294b9bcc8
9 changed files with 59 additions and 56 deletions
|
@ -6,6 +6,7 @@
|
|||
"extends": [
|
||||
"eslint:all",
|
||||
"plugin:jsdoc/recommended",
|
||||
"plugin:n/recommended",
|
||||
"plugin:unicorn/all"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
|
@ -39,12 +40,22 @@
|
|||
"example/*.js"
|
||||
],
|
||||
"rules": {
|
||||
"node/no-extraneous-require": "off",
|
||||
"n/no-extraneous-require": "off",
|
||||
"n/no-missing-require": "off",
|
||||
"no-console": "off",
|
||||
"no-invalid-this": "off",
|
||||
"no-shadow": "off",
|
||||
"object-property-newline": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"**/*.mjs"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2022,
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parserOptions": {
|
||||
|
@ -54,7 +65,7 @@
|
|||
"plugins": [
|
||||
"es",
|
||||
"jsdoc",
|
||||
"node",
|
||||
"n",
|
||||
"unicorn"
|
||||
],
|
||||
"reportUnusedDisableDirectives": true,
|
||||
|
@ -101,6 +112,7 @@
|
|||
"prefer-named-capture-group": "off",
|
||||
"prefer-template": "off",
|
||||
"require-unicode-regexp": "off",
|
||||
"sort-imports": "off",
|
||||
"sort-keys": "off",
|
||||
"space-before-function-paren": ["error", "never"],
|
||||
"vars-on-top": "off",
|
||||
|
@ -150,47 +162,43 @@
|
|||
"jsdoc/tag-lines": "error",
|
||||
"jsdoc/valid-types": "error",
|
||||
|
||||
"node/handle-callback-err": "error",
|
||||
"node/no-callback-literal": "error",
|
||||
"node/no-exports-assign": "error",
|
||||
"node/no-extraneous-import": "error",
|
||||
"node/no-extraneous-require": "error",
|
||||
"node/no-missing-import": "error",
|
||||
"node/no-missing-require": "off",
|
||||
"node/no-new-require": "error",
|
||||
"node/no-path-concat": "error",
|
||||
"node/no-process-exit": "error",
|
||||
"node/no-unpublished-bin": "error",
|
||||
"node/no-unpublished-import": "error",
|
||||
"node/no-unpublished-require": "error",
|
||||
"node/no-unsupported-features/es-builtins": "error",
|
||||
"node/no-unsupported-features/es-syntax": "error",
|
||||
"node/no-unsupported-features/node-builtins": ["error", {
|
||||
"ignores": [
|
||||
"fs.promises"
|
||||
]
|
||||
}],
|
||||
"node/process-exit-as-throw": "error",
|
||||
"node/shebang": "error",
|
||||
"node/no-deprecated-api": "error",
|
||||
"node/callback-return": "error",
|
||||
"node/exports-style": "error",
|
||||
"node/file-extension-in-import": "error",
|
||||
"node/global-require": "off",
|
||||
"node/no-mixed-requires": "error",
|
||||
"node/no-process-env": "error",
|
||||
"node/no-restricted-import": "error",
|
||||
"node/no-restricted-require": "error",
|
||||
"node/no-sync": "off",
|
||||
"node/prefer-global/buffer": "error",
|
||||
"node/prefer-global/console": "error",
|
||||
"node/prefer-global/process": "error",
|
||||
"node/prefer-global/text-decoder": "error",
|
||||
"node/prefer-global/text-encoder": "error",
|
||||
"node/prefer-global/url-search-params": "error",
|
||||
"node/prefer-global/url": "error",
|
||||
"node/prefer-promises/dns": "error",
|
||||
"node/prefer-promises/fs": "off",
|
||||
"n/handle-callback-err": "error",
|
||||
"n/no-callback-literal": "error",
|
||||
"n/no-exports-assign": "error",
|
||||
"n/no-extraneous-import": "error",
|
||||
"n/no-extraneous-require": "error",
|
||||
"n/no-missing-import": "error",
|
||||
"n/no-missing-require": "error",
|
||||
"n/no-new-require": "error",
|
||||
"n/no-path-concat": "error",
|
||||
"n/no-process-exit": "error",
|
||||
"n/no-unpublished-bin": "error",
|
||||
"n/no-unpublished-import": "error",
|
||||
"n/no-unpublished-require": "error",
|
||||
"n/no-unsupported-features/es-builtins": "error",
|
||||
"n/no-unsupported-features/es-syntax": "error",
|
||||
"n/no-unsupported-features/node-builtins": "error",
|
||||
"n/process-exit-as-throw": "error",
|
||||
"n/shebang": "error",
|
||||
"n/no-deprecated-api": "error",
|
||||
"n/callback-return": "error",
|
||||
"n/exports-style": "error",
|
||||
"n/file-extension-in-import": "error",
|
||||
"n/global-require": "off",
|
||||
"n/no-mixed-requires": "error",
|
||||
"n/no-process-env": "error",
|
||||
"n/no-restricted-import": "error",
|
||||
"n/no-restricted-require": "error",
|
||||
"n/no-sync": "off",
|
||||
"n/prefer-global/buffer": "error",
|
||||
"n/prefer-global/console": "error",
|
||||
"n/prefer-global/process": "error",
|
||||
"n/prefer-global/text-decoder": "error",
|
||||
"n/prefer-global/text-encoder": "error",
|
||||
"n/prefer-global/url-search-params": "error",
|
||||
"n/prefer-global/url": "error",
|
||||
"n/prefer-promises/dns": "error",
|
||||
"n/prefer-promises/fs": "error",
|
||||
|
||||
"unicorn/better-regex": "off",
|
||||
"unicorn/consistent-function-scoping": "off",
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
"example": "cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint",
|
||||
"docker-npm-install": "docker run --rm --tty --name npm-install --volume $PWD:/home/workdir --workdir /home/workdir --user node node:16 npm install",
|
||||
"docker-npm-run-upgrade": "docker run --rm --tty --name npm-run-upgrade --volume $PWD:/home/workdir --workdir /home/workdir --user node node:16 npm run upgrade",
|
||||
"lint": "eslint --max-warnings 0 .",
|
||||
"lint": "eslint --ext .js,.mjs --max-warnings 0 .",
|
||||
"lint-test-repos": "ava --timeout=5m test/markdownlint-test-repos.js",
|
||||
"serial-declaration-demo": "npm run build-declaration && npm-run-all --continue-on-error --parallel build-demo test-declaration",
|
||||
"test": "ava test/markdownlint-test.js test/markdownlint-test-config.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js",
|
||||
|
@ -65,7 +65,7 @@
|
|||
"eslint": "8.26.0",
|
||||
"eslint-plugin-es": "4.1.0",
|
||||
"eslint-plugin-jsdoc": "39.3.24",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-n": "15.3.0",
|
||||
"eslint-plugin-unicorn": "44.0.2",
|
||||
"globby": "13.1.2",
|
||||
"js-yaml": "4.1.0",
|
||||
|
|
|
@ -12,7 +12,6 @@ const [ command, ...args ] = process.argv.slice(2);
|
|||
const [ src, dest ] = args;
|
||||
await fs.copyFile(src, dest);
|
||||
} else if (command === "delete") {
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { globby } = await import("globby");
|
||||
await Promise.all(
|
||||
args.flatMap(
|
||||
|
|
|
@ -8,7 +8,6 @@ const markdownlint = require("../lib/markdownlint");
|
|||
// Parses all Markdown files in all package dependencies
|
||||
test("parseAllFiles", async(t) => {
|
||||
t.plan(1);
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { globby } = await import("globby");
|
||||
const files = await globby("**/*.{md,markdown}");
|
||||
await markdownlint.promises.markdownlint({ files });
|
||||
|
|
|
@ -22,9 +22,7 @@ const readConfigPromise = promisify(markdownlint.readConfig);
|
|||
*/
|
||||
async function lintTestRepo(t, globPatterns, configPath, ignoreRes) {
|
||||
t.plan(1);
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { globby } = await import("globby");
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { "default": stripJsonComments } = await import("strip-json-comments");
|
||||
const jsoncParse = (json) => {
|
||||
const config = JSON.parse(stripJsonComments(json));
|
||||
|
|
|
@ -1081,7 +1081,6 @@ test("validateConfigSchemaAppliesToUnknownProperties", (t) => {
|
|||
|
||||
test("validateConfigExampleJson", async(t) => {
|
||||
t.plan(2);
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { "default": stripJsonComments } = await import("strip-json-comments");
|
||||
// Validate JSONC
|
||||
const fileJson = ".markdownlint.jsonc";
|
||||
|
@ -1357,7 +1356,6 @@ test("configParsersJSON", async(t) => {
|
|||
|
||||
test("configParsersJSONC", async(t) => {
|
||||
t.plan(1);
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { "default": stripJsonComments } = await import("strip-json-comments");
|
||||
const options = {
|
||||
"strings": {
|
||||
|
@ -1401,7 +1399,6 @@ test("configParsersYAML", async(t) => {
|
|||
|
||||
test("configParsersTOML", async(t) => {
|
||||
t.plan(1);
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { "default": stripJsonComments } = await import("strip-json-comments");
|
||||
const options = {
|
||||
"strings": {
|
||||
|
|
|
@ -12,7 +12,9 @@ const strings = {
|
|||
|
||||
const start = new Date();
|
||||
for (let i = 0; i < 250; i++) {
|
||||
await markdownlint({strings});
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await markdownlint({ strings });
|
||||
}
|
||||
const end = new Date();
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Elapsed: ${end - start}`);
|
||||
|
|
|
@ -17,7 +17,7 @@ const languageJavaScript = /js|javascript/i;
|
|||
function cleanJsdocRulesFromEslintConfig(config) {
|
||||
const cleanedConfig = { ...config };
|
||||
for (const rule in config.rules) {
|
||||
if (/^(es|jsdoc|node|unicorn)\//.test(rule)) {
|
||||
if (/^(es|jsdoc|n|unicorn)\//.test(rule)) {
|
||||
delete cleanedConfig.rules[rule];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ module.exports = {
|
|||
"tags": [ "test", "validate", "json" ],
|
||||
"asynchronous": true,
|
||||
"function": async(params, onError) => {
|
||||
// eslint-disable-next-line max-len, node/no-unsupported-features/es-syntax
|
||||
const { "default": stripJsonComments } = await import("strip-json-comments");
|
||||
const { "default": stripJsonComments } =
|
||||
await import("strip-json-comments");
|
||||
filterTokens(params, "fence", (fence) => {
|
||||
if (/jsonc?/i.test(fence.info)) {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue