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

tools: remove fixer for non-ascii-character ESLint custom rule #38413

Merged
merged 1 commit into from Apr 28, 2021
Merged
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
26 changes: 26 additions & 0 deletions test/parallel/test-eslint-non-ascii-character.js
@@ -0,0 +1,26 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/non-ascii-character');

new RuleTester().run('non-ascii-characters', rule, {
valid: [
{
code: 'console.log("fhqwhgads")',
options: []
},
],
invalid: [
{
code: 'console.log("μ")',
options: [],
errors: [{ message: "Non-ASCII character 'μ' detected." }],
},
]
});
10 changes: 0 additions & 10 deletions tools/eslint-rules/non-ascii-character.js
Expand Up @@ -46,20 +46,10 @@ module.exports = (context) => {
node,
message,
loc: sourceCode.getLocFromIndex(offendingCharacterPosition),
fix: (fixer) => {
return fixer.replaceText(
node,
suggestion ? `${suggestion}` : ''
);
}
});
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
};

return {
Program: (node) => reportIfError(node, context.getSourceCode())
};
};

module.exports.meta = {
fixable: 'code'
};