Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kyoncy/eslint-plugin-jsx-dollar

Eslint plugin that check JSXText's unnecessary template literal `$` character.
https://github.com/kyoncy/eslint-plugin-jsx-dollar

eslint eslint-plugin jsx template-literals

Last synced: about 16 hours ago
JSON representation

Eslint plugin that check JSXText's unnecessary template literal `$` character.

Awesome Lists containing this project

README

        

# eslint-plugin-jsx-dollar
Eslint plugin that check JSXText's unnecessary template literal `$` character.

[![npm version](https://img.shields.io/npm/v/eslint-plugin-jsx-dollar.svg)](https://www.npmjs.com/package/eslint-plugin-jsx-dollar)
[![minified size](https://img.shields.io/bundlephobia/min/eslint-plugin-jsx-dollar/latest)](https://bundlephobia.com/result?p=eslint-plugin-jsx-dollar)
[![minzipped size](https://img.shields.io/bundlephobia/minzip/eslint-plugin-jsx-dollar/latest)](https://bundlephobia.com/result?p=eslint-plugin-jsx-dollar)

## Install
```
yarn add -D eslint-plugin-jsx-dollar
```

`.eslintrc.js`

```js
module.exports = {
"plugins": [
...,
"jsx-dollar"
],
"rules": [
...,
"jsx-dollar/jsxDollar": "error",
]
...,
}
```

## Example
When using JavaScript template literals, use `` `${expression}` ``.
But, we rarely typo `` ${} `` in JSX text.

Details are shown below.

```tsx
const text = "sample";

export const Success: React.FC = () => {
return (
{`${text}`}
// Equals sample
);
};

export const Failed: React.FC = () => {
return (
${text}
// Equals $sample
);
};
```

## Lisence
MIT