项目作者: totallymoney

项目描述 :
Prefer the use of curly quote/apostrophe characters
高级语言: JavaScript
项目地址: git://github.com/totallymoney/eslint-plugin-prefer-smart-quotes.git


eslint-plugin-prefer-smart-quotes

Enforce the preferred use of curly quote/apostrophe characters.

Fixable: This rule is automatically fixable using the --fix flag on the command line.

This plugin supports converting quotes and apostrophes that have been specified using their numeric or named equivalent into their curly named or numeric values.

Installation

You’ll first need to install ESLint:

  1. npm install eslint --save-dev

Then, you can install eslint-plugin-prefer-smart-quotes

  1. npm install eslint-plugin-prefer-smart-quotes --save-dev

Usage

Add the plugin to your eslint configuration file (.eslintrc.*):

  1. {
  2. "plugins": [
  3. "prefer-smart-quotes"
  4. ]
  5. }

To configure the plugin rules:

Convert all entities into their curly equivalent

  1. {
  2. "rules": {
  3. "prefer-smart-quotes/prefer": ["error", "all"]
  4. }
  5. }

Convert named values into their curly numeric equivalent

  1. {
  2. "rules": {
  3. "prefer-smart-quotes/prefer": ["error", { "inputFormat": "named", "outputFormat": "numeric" }]
  4. }
  5. }

Acknowledgements

Thanks to eslint-plugin-no-smart-quotes for serving as the basis
for this plugin.