1.0.1 • Published 4 months ago

eslint-plugin-ascii-x v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

ASCII fiXer (eslint-plugin-ascii-x)

NPM Version ESLint Version Node Current

ESLint plugin to delete or escape non-ASCII characters, using autofixes

Example using rule (ascii-x/ascii)

Example of original code:

/** foo 🅱ar */
console.log("¡Hello World!🏳️‍🌈");
let a = 2; // 🦊Answer
console.log(`🔢1+1=${a}`);

Example of corrected code:

/** foo ar */
console.log("\xA1Hello World!\u{1F3F3}\uFE0F\u200D\u{1F308}");
const a = 2; // Answer
console.log(`\u{1F522}1+1=${a}`);

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-ascii-x:

npm install eslint-plugin-ascii-x --save-dev

Usage

Add ascii-x to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "ascii-x"
    ]
}

Then configure the rule.

{
    "rules": {
        "ascii-x/ascii": "error"
    }
}

Rules

🔧 Automatically fixable by the --fix CLI option.

NameDescription🔧
asciiEnforce ASCII🔧

Planned Features

  • Separate rules for comments and strings
  • Whitelist characters
  • Suggest other replacements (e.g. left/right quotes)

Acknowledgements

1.0.1

4 months ago

1.0.0-release

4 months ago

1.0.0

4 months ago