| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 620ee42 commit 6350d35
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + if (!common.hasCrypto) | ||
| 5 | + common.skip('missing crypto'); | ||
| 6 | + | ||
| 7 | + common.skipIfEslintMissing(); | ||
| 8 | + | ||
| 9 | + const RuleTester = require('../../tools/node_modules/eslint').RuleTester; | ||
| 10 | + const rule = require('../../tools/eslint-rules/non-ascii-character'); | ||
| 11 | + | ||
| 12 | + new RuleTester().run('non-ascii-characters', rule, { | ||
| 13 | + valid: [ | ||
| 14 | + { | ||
| 15 | + code: 'console.log("fhqwhgads")', | ||
| 16 | + options: [] | ||
| 17 | + }, | ||
| 18 | + ], | ||
| 19 | + invalid: [ | ||
| 20 | + { | ||
| 21 | + code: 'console.log("μ")', | ||
| 22 | + options: [], | ||
| 23 | + errors: [{ message: "Non-ASCII character 'μ' detected." }], | ||
| 24 | + }, | ||
| 25 | + ] | ||
| 26 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,20 +46,10 @@ module.exports = (context) => { | |||
| 46 | 46 | node, | |
| 47 | 47 | message, | |
| 48 | 48 | loc: sourceCode.getLocFromIndex(offendingCharacterPosition), | |
| 49 | - fix: (fixer) => { | ||
| 50 | - return fixer.replaceText( | ||
| 51 | - node, | ||
| 52 | - suggestion ? `${suggestion}` : '' | ||
| 53 | - ); | ||
| 54 | - } | ||
| 55 | 49 | }); | |
| 56 | 50 | }; | |
| 57 | 51 | ||
| 58 | 52 | return { | |
| 59 | 53 | Program: (node) => reportIfError(node, context.getSourceCode()) | |
| 60 | 54 | }; | |
| 61 | 55 | }; | |
| 62 | - | ||
| 63 | - module.exports.meta = { | ||
| 64 | - fixable: 'code' | ||
| 65 | - }; | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments