Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base indent for multiple line breaks; npm #126

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintignore
@@ -1 +1,5 @@
node_modules
coverage
tests/fixtures
tests/lib/processor.js
index.js
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ coverage/
node_modules/
npm-debug.log
.eslint-release-info.json
.nyc_output
3 changes: 3 additions & 0 deletions .npmignore
@@ -0,0 +1,3 @@
.nyc_output
coverage
tests
4 changes: 2 additions & 2 deletions lib/processor.js
Expand Up @@ -273,7 +273,7 @@ function adjustBlock(block) {
/**
* Adjusts ESLint messages to point to the correct location in the Markdown.
* @param {Message} message A message from ESLint.
* @returns {Message} The same message, but adjusted ot the correct location.
* @returns {Message} The same message, but adjusted to the correct location.
*/
return function adjustMessage(message) {

Expand Down Expand Up @@ -308,7 +308,7 @@ function adjustBlock(block) {
// Apply the mapping delta for this range.
return range + block.rangeMap[i - 1].md;
}),
text: message.fix.text.replace("\n", `\n${block.baseIndentText}`)
text: message.fix.text.replace(/\n/g, `\n${block.baseIndentText}`)
};
}

Expand Down
20 changes: 10 additions & 10 deletions package.json
Expand Up @@ -20,9 +20,9 @@
"linter"
],
"scripts": {
"lint": "eslint Makefile.js lib/**/*.js tests/lib/plugin.js",
"lint": "eslint .",
"test": "npm run lint && npm run test-cov",
"test-cov": "istanbul cover _mocha -- -c tests/lib/**/*.js",
"test-cov": "nyc _mocha -- -c tests/lib/**/*.js",
"generate-release": "eslint-generate-release",
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",
Expand All @@ -36,18 +36,18 @@
"lib/processor.js"
],
"devDependencies": {
"chai": "^3.0.0",
"eslint": "^4.19.1",
"chai": "^4.2.0",
"eslint": "^6.6.0",
"eslint-config-eslint": "^5.0.1",
"eslint-plugin-node": "^6.0.1",
"eslint-release": "^1.0.0",
"istanbul": "^0.4.5",
"mocha": "^2.2.5"
"eslint-release": "^1.2.0",
"mocha": "^6.2.2",
"nyc": "^14.1.1"
},
"dependencies": {
"object-assign": "^4.0.1",
"remark-parse": "^5.0.0",
"unified": "^6.1.2"
"object-assign": "^4.1.1",
"remark-parse": "^7.0.1",
"unified": "^8.4.1"
},
"engines": {
"node": "^6.14.0 || ^8.10.0 || >=9.10.0"
Expand Down
3 changes: 3 additions & 0 deletions tests/lib/plugin.js
Expand Up @@ -20,6 +20,7 @@ function initCLI(isAutofixEnabled) {
const cli = new CLIEngine({
envs: ["browser"],
extensions: ["md", "mkdn", "mdown", "markdown"],
plugins: ["markdown"],
fix,
ignore: false,
rules: {
Expand Down Expand Up @@ -665,6 +666,7 @@ describe("plugin", () => {
">",
"> > ```js",
"> > console.log('Hello, \\",
"> > new\\",
"> > world!')",
"> > console.log('Hello, \\",
"> > world!')",
Expand All @@ -682,6 +684,7 @@ describe("plugin", () => {
">",
"> > ```js",
"> > console.log(\"Hello, \\",
"> > new\\",
"> > world!\")",
"> > console.log(\"Hello, \\",
"> > world!\")",
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/processor.js
Expand Up @@ -188,7 +188,7 @@ describe("processor", function() {
var blocks = processor.preprocess(code);

assert.strictEqual(blocks.length, 1);
assert.strictEqual(blocks[0], "\n\n \n \n");
assert.strictEqual(blocks[0], "\n\n\n \n \n");
});

it("should ignore code fences with unspecified info string", function() {
Expand Down