mirror of
https://github.com/DavidAnson/markdownlint-cli2-action.git
synced 2024-11-27 16:46:22 +01:00
Add ESLint to test script, address new issues.
This commit is contained in:
parent
6f2edb0be1
commit
03a4399348
4 changed files with 137 additions and 11 deletions
117
.eslintrc.json
Normal file
117
.eslintrc.json
Normal file
|
@ -0,0 +1,117 @@
|
|||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"plugins": [
|
||||
"node",
|
||||
"unicorn"
|
||||
],
|
||||
"extends": [
|
||||
"eslint:all"
|
||||
],
|
||||
"reportUnusedDisableDirectives": true,
|
||||
"rules": {
|
||||
"indent": ["error", 2],
|
||||
"one-var": "off",
|
||||
"sort-keys": "off",
|
||||
|
||||
"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": "error",
|
||||
"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",
|
||||
"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": "error",
|
||||
"node/no-mixed-requires": "error",
|
||||
"node/no-process-env": "error",
|
||||
"node/no-restricted-import": "error",
|
||||
"node/no-restricted-require": "error",
|
||||
"node/no-sync": "error",
|
||||
"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": "error",
|
||||
|
||||
"unicorn/better-regex": "error",
|
||||
"unicorn/catch-error-name": "error",
|
||||
"unicorn/consistent-function-scoping": "error",
|
||||
"unicorn/custom-error-definition": "error",
|
||||
"unicorn/error-message": "error",
|
||||
"unicorn/escape-case": "error",
|
||||
"unicorn/expiring-todo-comments": "error",
|
||||
"unicorn/explicit-length-check": "error",
|
||||
"unicorn/filename-case": "error",
|
||||
"unicorn/import-index": "error",
|
||||
"unicorn/import-style": "error",
|
||||
"unicorn/new-for-builtins": "error",
|
||||
"unicorn/no-abusive-eslint-disable": "error",
|
||||
"unicorn/no-array-instanceof": "error",
|
||||
"unicorn/no-console-spaces": "error",
|
||||
"unicorn/no-fn-reference-in-iterator": "error",
|
||||
"unicorn/no-for-loop": "error",
|
||||
"unicorn/no-hex-escape": "error",
|
||||
"unicorn/no-keyword-prefix": "error",
|
||||
"unicorn/no-nested-ternary": "error",
|
||||
"unicorn/no-new-buffer": "error",
|
||||
"unicorn/no-null": "error",
|
||||
"unicorn/no-object-as-default-parameter": "error",
|
||||
"unicorn/no-process-exit": "error",
|
||||
"unicorn/no-reduce": "error",
|
||||
"unicorn/no-unreadable-array-destructuring": "error",
|
||||
"unicorn/no-unsafe-regex": "error",
|
||||
"unicorn/no-unused-properties": "error",
|
||||
"unicorn/no-useless-undefined": "error",
|
||||
"unicorn/no-zero-fractions": "error",
|
||||
"unicorn/number-literal-case": "error",
|
||||
"unicorn/prefer-add-event-listener": "error",
|
||||
"unicorn/prefer-array-find": "error",
|
||||
"unicorn/prefer-dataset": "error",
|
||||
"unicorn/prefer-event-key": "error",
|
||||
"unicorn/prefer-flat-map": "error",
|
||||
"unicorn/prefer-includes": "error",
|
||||
"unicorn/prefer-modern-dom-apis": "error",
|
||||
"unicorn/prefer-negative-index": "error",
|
||||
"unicorn/prefer-node-append": "error",
|
||||
"unicorn/prefer-node-remove": "error",
|
||||
"unicorn/prefer-number-properties": "error",
|
||||
"unicorn/prefer-optional-catch-binding": "error",
|
||||
"unicorn/prefer-query-selector": "error",
|
||||
"unicorn/prefer-reflect-apply": "error",
|
||||
"unicorn/prefer-replace-all": "error",
|
||||
"unicorn/prefer-set-has": "error",
|
||||
"unicorn/prefer-spread": "error",
|
||||
"unicorn/prefer-starts-ends-with": "error",
|
||||
"unicorn/prefer-string-slice": "error",
|
||||
"unicorn/prefer-text-content": "error",
|
||||
"unicorn/prefer-trim-start-end": "error",
|
||||
"unicorn/prefer-type-error": "error",
|
||||
"unicorn/prevent-abbreviations": "error",
|
||||
"unicorn/string-content": "error",
|
||||
"unicorn/throw-new-error": "error"
|
||||
}
|
||||
}
|
12
dist/index.js
vendored
12
dist/index.js
vendored
|
@ -11,20 +11,22 @@ module.exports =
|
|||
|
||||
|
||||
const core = __nccwpck_require__(2186);
|
||||
// const github = require("@actions/github");
|
||||
const { "main": markdownlintCli2 } = __nccwpck_require__(9202);
|
||||
const {"main": markdownlintCli2} = __nccwpck_require__(9202);
|
||||
|
||||
const logMessage = core.info;
|
||||
const logError = core.error;
|
||||
const argv = core.getInput("globs").split("\n").filter(String);
|
||||
const argv =
|
||||
core.getInput("globs").
|
||||
split("\n").
|
||||
filter(String);
|
||||
|
||||
markdownlintCli2({
|
||||
argv,
|
||||
logMessage,
|
||||
logError
|
||||
}).then(
|
||||
(exitCode) => exitCode && core.setFailed(`Failed with exit code: ${exitCode}`),
|
||||
(reason) => core.setFailed(`Failed due to reason: ${reason}`)
|
||||
(code) => code && core.setFailed(`Failed with exit code: ${code}`),
|
||||
(error) => core.setFailed(`Failed due to error: ${error}`)
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -3,17 +3,20 @@
|
|||
"use strict";
|
||||
|
||||
const core = require("@actions/core");
|
||||
const { "main": markdownlintCli2 } = require("markdownlint-cli2");
|
||||
const {"main": markdownlintCli2} = require("markdownlint-cli2");
|
||||
|
||||
const logMessage = core.info;
|
||||
const logError = core.error;
|
||||
const argv = core.getInput("globs").split("\n").filter(String);
|
||||
const argv =
|
||||
core.getInput("globs").
|
||||
split("\n").
|
||||
filter(String);
|
||||
|
||||
markdownlintCli2({
|
||||
argv,
|
||||
logMessage,
|
||||
logError
|
||||
}).then(
|
||||
(exitCode) => exitCode && core.setFailed(`Failed with exit code: ${exitCode}`),
|
||||
(reason) => core.setFailed(`Failed due to reason: ${reason}`)
|
||||
(code) => code && core.setFailed(`Failed with exit code: ${code}`),
|
||||
(error) => core.setFailed(`Failed due to error: ${error}`)
|
||||
);
|
||||
|
|
|
@ -13,13 +13,17 @@
|
|||
},
|
||||
"bugs": "https://github.com/DavidAnson/markdownlint-cli2-action/issues",
|
||||
"scripts": {
|
||||
"build": "ncc build markdownlint-cli2-action.js"
|
||||
"build": "ncc build markdownlint-cli2-action.js",
|
||||
"test": "eslint *.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "~1.2.6",
|
||||
"markdownlint-cli2": "~0.0.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "~0.27.0"
|
||||
"@vercel/ncc": "~0.27.0",
|
||||
"eslint": "~7.18.0",
|
||||
"eslint-plugin-node": "~11.1.0",
|
||||
"eslint-plugin-unicorn": "~26.0.1"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue