Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/natterstefan/plop-action-eslint

A Plop action to lint files with ESLint and automatically format with Prettier.
https://github.com/natterstefan/plop-action-eslint

eslint plop plop-action plop-helper plop-pack plopjs prettier

Last synced: about 2 months ago
JSON representation

A Plop action to lint files with ESLint and automatically format with Prettier.

Awesome Lists containing this project

README

        

# plop-action-eslint

[![npm version](https://badge.fury.io/js/plop-action-eslint.svg)](https://badge.fury.io/js/plop-action-eslint)
[![GitHub license](https://img.shields.io/github/license/natterstefan/plop-action-eslint.svg)](https://github.com/natterstefan/plop-action-eslint/blob/main/LICENSE)
[![Node CI](https://github.com/natterstefan/plop-action-eslint/actions/workflows/ci.yml/badge.svg)](https://github.com/natterstefan/plop-action-eslint/actions/workflows/ci.yml)

A [Plop](https://github.com/plopjs/plop) action to lint files with
[ESLint](https://eslint.org/) and automatically format with
[Prettier](#prettier-support).

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Actions](#actions)
- [Prettier Support](#prettier-support)

## Installation

```sh
npm install plop-action-eslint --save-dev

# or with yarn
yarn add plop-action-eslint -D
```

## Usage

Before you can use `plop-action-eslint`, you have to load it into the `plop`
object by adding the folling to your `plopfile.js`:

```javascript
// plopfile.js
module.exports = async plop => {
await plop.load('plop-action-eslint')
}
```

Once loaded, you have access the following actions.

### Actions

#### `eslint`

Lints and fixes (autofix is enabled) the file of the given path with your
projects ESLint configuration.

```javascript
{
type: "eslint",
path: "src/component/{{pascalCase name}}.js",
}
```

You can also pass an array of paths.

```javascript
{
type: "eslint",
path: [
"src/component/{{pascalCase name}}.js",
"src/component/{{pascalCase name}}.test.js",
],
}
```

## Prettier Support

In order to automatically format your code with Prettier as well, you have to
use [eslint-config-prettier][1] and [eslint-plugin-prettier][2] in your ESLint
configuration.

## How to release

### Manually trigger release

```bash
# generate a new tag
yarn lerna:version

# generate a new Changelog entry
npx lerna-changelog --from --to
# add the result manually to CHANGELOG.md and commit it
git add CHANGELOG.md
git commit -m "chore: prepared release"

# push the tags
git push --tags

# publish the new version
yarn lerna:publish
```

## License

[MIT](./LICENSE)

## Contributors ✨

Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):



Stefan Natter
Stefan Natter

💻
Vytenis
Vytenis

💻
Ivan Holovin
Ivan Holovin

💻
Oliver Lillie
Oliver Lillie

💻

This project follows the
[all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!

## Credits

This plop action is based on the code that was shared in
[plop#80](https://github.com/plopjs/plop/issues/80#issuecomment-645179250) by
[FDiskas](https://github.com/FDiskas).

[1]: https://github.com/prettier/eslint-config-prettier
[2]: https://github.com/prettier/eslint-plugin-prettier