Giter VIP home page Giter VIP logo

eslint-plugin's Introduction

Version Bundle size License Support me on Ko-fi


About

  • A shared ESLint plugin/config used by me; they are used in many of my open source projects and is a pain to copy-paste the long configs every time, so I made it into a package instead.
  • The configs assume the project using it are written in TypeScript, but they should work just fine with plain JavaScript in most circumstances.
  • It is named eslint-plugin, not eslint-config because I might be adding custom rules to this package in the future. So calling it "plugin" would be more appropriate in the long run.

Disclaimer

  • The compilation of rules are just my personal preferences.
  • There might be drastic changes in the configs from one version to another, and this applies for all future versions until this package reaches a stable version.

Installation

With NPM:

npm i -D @glyphcat/eslint-plugin

With Yarn:

yarn add -D @glyphcat/eslint-plugin

Usage

You can extend from one of the two available configs:

// .eslintrc.js
module.exports = {
  extends: [

    // For developing websites and apps:
    'plugin:@glyphcat/recommended',

    // For maintaining libraries:
    'plugin:@glyphcat/strict',
    // (Same as '/recommended', but warnings are treated as errors)

  ],
}

Known Issues & Ways Around Them

In some cases, you may get errors like this:

ESLint couldn't determine the plugin "import" uniquely.

Even with enough expertise in the NPM/Yarn/NodeJS ecosystem, you might be able to solve it once before receiving the same error for another plugin.

Below are some approaches you can try to get around this problem. They are not guaranteed to work, but should increase your odds in solving this problem.


1. Use Yarn resolutions

This ESLint guide explains how to resolve package conflicts by adding a resolution property to your project's package.json.


2. Update ESLint Plugin Dependencies

Update any dependencies related to ESLint to the latest versions available (along with this one).

I will try to update this package as often as possible so that any plugins that this package depends on stays up to date.

For example, your project might be using eslint-config-next.

Under the hood, both eslint-config-next and @glyphcat/eslint-plugin uses eslint-plugin-import.

When they depend on different versions of eslint-plugin-import, this causes the error "ESLint couldn't determine the plugin "import" uniquely." to appear.

If the latest versions of eslint-config-next and @glyphcat/eslint-plugin depend the same version of eslint-plugin-import, updating the packages would solve the error.


3. Pray

If all else fails, contact the authors of the related plugin libraries and pray that the depended libraries can be updated soon so that you can resolve the issue with Method #2.


Support Me


eslint-plugin's People

Contributors

glyph-cat avatar

Watchers

 avatar

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.