Skip to content

Commit

Permalink
Merge pull request #181 from kellyselden/prevent_double_EOL
Browse files Browse the repository at this point in the history
fix: prevent double newline
  • Loading branch information
kellyselden authored Aug 22, 2024
2 parents fbca316 + c432abf commit c68ad26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions lib/rules/validate-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const Ajv = require('ajv');
const { default: betterAjvErrors } = require('better-ajv-errors');
const { EOL } = require('os');

let ajv;

Expand Down Expand Up @@ -77,7 +76,7 @@ module.exports = {
let validate = ajvFix.compile(schema);
validate(packageJson);

return fixer.replaceText(packageJsonNode, JSON.stringify(packageJson, null, 2) + EOL);
return fixer.replaceText(packageJsonNode, JSON.stringify(packageJson, null, 2));
}
});
}
Expand Down
9 changes: 3 additions & 6 deletions tests/lib/rules/validate-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ new RuleTester().run('validate-schema', rule, preprocess({
}],
output: `{
"foo": "bar"
}
`
}`
},
{
code: '{"foo":"bar"}',
Expand All @@ -63,8 +62,7 @@ new RuleTester().run('validate-schema', rule, preprocess({
}],
output: `{
"foo": "bar"
}
`
}`
},
{
code: '{"foo":"bar","bar":"foo"}',
Expand All @@ -89,8 +87,7 @@ new RuleTester().run('validate-schema', rule, preprocess({
}],
output: `{
"foo": "bar"
}
`
}`
}
]
}));

0 comments on commit c68ad26

Please sign in to comment.