Coder Social home page Coder Social logo

natterstefan / plop-action-eslint Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 3.0 699 KB

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

Home Page: https://www.npmjs.com/package/plop-action-eslint

License: MIT License

JavaScript 57.73% Shell 4.86% TypeScript 37.40%
eslint plop-action plop-helper plop-pack plopjs plop prettier

plop-action-eslint's Introduction

plop-action-eslint

npm version GitHub license Node CI

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

Table of Contents

Installation

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:

// 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.

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

You can also pass an array of paths.

{
  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 and eslint-plugin-prettier in your ESLint configuration.

How to release

Manually trigger release

# generate a new tag
yarn lerna:version

# generate a new Changelog entry
npx lerna-changelog --from <tag> --to <tag>
# 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

Contributors โœจ

Thanks goes to these wonderful people (emoji key):

Stefan Natter
Stefan Natter

๐Ÿ’ป
Vytenis
Vytenis

๐Ÿ’ป
Ivan Holovin
Ivan Holovin

๐Ÿ’ป
Oliver Lillie
Oliver Lillie

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

This plop action is based on the code that was shared in plop#80 by FDiskas.

plop-action-eslint's People

Contributors

buggedcom avatar iholovin avatar natterstefan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

plop-action-eslint's Issues

[Feature] Allow passing an array of strings to actions's path property

Feature Request

Since eslint.lintFiles accepts string | string[] we need to pass an array of paths in order to run eslint on multiple files in different locations. As plopInstance.renderString() can be run only on string and cannot accept an array - we can modify the action to check if path is an array and map each item with plopInstance.renderString().

Basic example

    {
      type: "eslint",
      path: ["path1", "path2", ...],
    }

Motivation

If you use Plop to generate multiple files in different folders or you modify multiple files - currently it's not possible to pass multiple corresponding paths to the action.

Support node 18

Feature Request

Node 18 is now the official LTS version of node, but the package.json restricts installation to node 14 or 16. Can you remove/relax the engines restriction?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.