1.3.0 • Published 18 days ago

eslint-plugin-curly-quotes v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
18 days ago

eslint-plugin-curly-quotes

Enforce the use of curly quotes and apostrophes.

Simple and customizable 🔧 Compatible with JavaScript, TypeScript, JSX and Vue!

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

CAUTION

The plugin replaces quotes used in query selector or stringified JSON strings when using the --fix flag on the command line. To ignore a specific string:

Use tagged template literals:

String.raw`{"foo": "bar"}`

Or disable the rule for the line:

const data = '{"foo": "bar"}' // eslint-disable-line curly-quotes/no-straight-quotes

Installation

Install ESLint:

npm i --save-dev eslint

Install eslint-plugin-curly-quotes:

npm i --save-dev eslint-plugin-curly-quotes

Usage

Add eslint-plugin-curly-quotes to the plugins section of your .eslintrc configuration file:

{
  "plugins": ["curly-quotes"]
}

Then add the no-straight-quotes rule to the rules section:

{
  "rules": {
    "curly-quotes/no-straight-quotes": "warn"
  }
}

You may customize the characters used to replace straight quotes:

{
  "rules": {
    "curly-quotes/no-straight-quotes": [
      "warn",
      {
        "single-opening": "‘",
        "single-closing": "’", // This character is also used to replace apostrophes.
        "double-opening": "“",
        "double-closing": "”",
        "ignored-jsx-elements": ["script", "style"], // Straight quotes in these JSX elements are ignored.
        "ignored-jsx-attributes": ["className"], // Straight quotes in these JSX attributes are ignored.
        "ignored-function-calls": ["Error"] // Straight quotes passed as parameters to these functions are ignored.
      }
    ]
  }
}

Acknowledgements

1.3.0

18 days ago

1.2.0

2 months ago

1.2.1

2 months ago

1.1.0

2 months ago

1.0.9

7 months ago

1.0.10

7 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.0

2 years ago