Giter Site home page Giter Site logo

eslint-nibble's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eslint-nibble's Issues

package.lock.json size

It is not an issue. Just wondering. Is it OK that package.lock.json has a size of 13k lines?

Avoid strictive rules using `eslint-nibble`

Hi Ian,

I am pleased to endorse this package. ESLint is a necessary package. On available packages, the errors are not easy to treat one by one. At this moment, I fix all my lint-ycal issues.

I would like to ask/suggest a feature: given the .eslintrc config file, how is it possible to avoid some specific rule by using eslint-nibble? Typically, as seen below, eslint extends some specific indentation style in my case 'airbnb-base'. Sometimes there is a rule one wants to avoid because it is too strict, for example, the camelcase rule on the image below.

module.exports = {
  env: {
    browser: true,
    es2021: true,
  },
  extends: [
    'airbnb-base',
  ],
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
  },
  rules: {
  },
};

image

Fix all fixable eslint issues

Since fixable eslint issues may be hand by hand fixed, a natural feature is to allow users to have the option to autofix all fixable ones.

Option to just print all errors - use for CI lint enforcements

I have a large app with various lint errors, I want to apply the auto fix only to a select set of rules. This project does a beautiful job, I’d like to use it in CI to lint a select set of rules- if there’s errors it fails the build. This would let me enforce linting across things we already fixed. I cannot run lint in CI due to number of errors.

Support ESLint 5

Get TypeError: Cannot read property 'ecmaFeatures' of undefined

Feature request: --only-fixable

It would be great to be able to use this package and filter by those rules that are auto-fixable by eslint.

You could also implement this as some kind of indication on the initial report of rule violations as to which ones are fixable.

Option to disable inquiry.

Linting is a common task run in tests. It would be nice if this project could detect the NODE_ENV and disable the prompt.

Add --cache flag

ESLint supports a --cache flag that can dramatically speed up linting. Adding this to nibble would also speed it up (presumably).

Allow a custom .eslintrc file

For our project we have two .eslintrcfiles, .eslintrc which is what we're currently enforcing and .eslintrc.nextwhich is where we'd like to be.

It would be nice if you could pass in a custom .eslintrc file to nibble like you can with ESLint—eslint -c .eslintrc.next.

Jest statements `no-undef` eslint error

The test framework Jest is very useful for programmers. However, eslint dislikes its statements: it, expect, describe and beforeEach, among others. Maybe I am asking in the wrong place, I ask you to say if so:

Is the a manner to either walk around or fix this "issue"?

How to pass additional config for a rule

Hey, the project is awesome!

I would like to use it with import/no-unused-modules rule from eslint-plugin-import plugin but not sure how to pass additional config for that rule.

Is there an option do use something like this --rule="{ import/no-unused-modules: [2, { unusedExports: true }] }"?

Thanks!

Only pass previously errored filenames when fixing

If I run eslint-nibble on 10,000 files (which takes, say, 5 minutes to process), and the rule I select only has an error in 200 files, I would expect eslint to take, say, 1 minute to run on only those 200 files, instead of the full 5 minutes to run on all 10K files.

This could be achieved by minimizing what file paths are passed to the eslint --fix run - via a custom ignore file that ignores the non-errored files; or via a glob path that minimizes which un-errored files are processed the second time around.

Cannot find babel-eslint

When installed globally, eslint-nibble does not have access to plugins, custom parsers, or shared configs which are installed in the project.

If eslint-nibble needs to be installed globally, those other packages can also be installed globally, but a better way is probably to install eslint-nibble locally to the project. The usage instructions should be updated to reflect this.

Add per-rule autofixing

The latest (upcoming) version of ESLint supports more control over fixes, so eslint-nibble should be able to fix individual rules automatically.

Can't install eslint-nibble without `git` on system

Throws an error when trying to install:

/usr/app # npm install --no-save eslint-nibble
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/joi. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/ianvs/eslint-stats.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-28T11_52_03_443Z-debug.log


Here is my env:

node: v10.16.3
os: linux alpine
npm: v6.9.0
eslint: v6.1.0

Next release

Hi @IanVS, thanks for this package.

Any ETA on the next npm release which should include the new CLI flags such as --no-interactive?

Can I skip selecting an rule to "fix"?

Select one of the rules by arrowing up/down and pressing enter

What can I do at this stage if I don't want to fix anything. I just wanted to see a report.

Auto-fixing errors completes but throws an exception

When running eslint-nibble interactively and attempting to auto-fix errors, the errors are auto-fixed but eslint-nibble exits after throwing the following exception:

? Which rule would you like to view? no-multi-spaces
? Would you like to attempt to auto-fix? Yes
(node:11384) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
    at filterResults (/home/chris/project/git-workflow/csr512-test-openidm-config/config/node_modules/eslint-nibble/src/nibbler.js:63:39)
    at Object.getRuleResults (/home/chris/project/git-workflow/csr512-test-openidm-config/config/node_modules/eslint-nibble/src/nibbler.js:149:9)
    at gotInput (/home/chris/project/git-workflow/csr512-test-openidm-config/config/node_modules/eslint-nibble/src/cli.js:183:43)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11384) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11384) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This error should be easy to replicate by running eslint-nibble interactively against a file with auto-fixable errors and answering y when asked about attempting to auto-fix them.

$ npx eslint-nibble -v
v8.0.0

Fixes all issues when selecting only one rule

When selecting a particular rule to be fixed:

image

It will ask for confirmation:

image

image

And after hitting enter it will fix all issues, not just the one that I have chosen.

Any ideas of why this could be happening?

My package.json looks like:

"nibble": "eslint-nibble --ext .jsx,.js client/"

Select multiple rules at a time?

I'd love a way to select multiple rules at a time, in particular so I can apply multiple whitespace rules all at once (generating the initial report takes a lot of time)

Add API

This tool is intended to be used as a CLI, but as an npm module maybe it should also have an API? Currently the main of package.json is broken, so this module cannot be required. I need to think about use cases which may warrant a possible API.

Run a specific rule from the cli

Hi

  1. Loving this tool! It's saving me from a lot of head-aches.
  2. I've looked through the readme, but I'm not sure I understand the --non-interactive flag correctly. Does this mode allow me to specify a rule in the cli which nibble would auto-fix?

I have a monorepo with 28 apps in it and navigating into every app one-at-a-time is a bit of pain. I've tried using the rule in combilation with the --rule flag but the desired outcome isn't quite there yet.

Error: Cannot find module 'babel/polyfill'

Hello,

Babel is actually required to run eslint-nibble, so it fails if Babel is not installed with this error :

module.js:338
    throw err;
          ^
Error: Cannot find module 'babel/polyfill'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/.../my-project/node_modules/eslint-nibble/index.js:4:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

Line-ignore feature request

First off -- awesome project! We've been using this at Condé Nast to help with summaries of lint rule impact, as well as helping us roll out the changes / fixes.

That said, we've found that in general, lint, especially at company scale, is a challenging thing to work with. Providing best practice rules, while being realistic about the downstream impact to your consumers is tricky. Tools like this certainly help us find our way forward, however sometimes it takes multiple strategies.

Right now our flow looks like:

  1. Choose new rule or ruleset (or upgrade a base package).
  2. Fix all offending lines of code to get back to 0 errors and ~0 warnings.
  3. Disable any rules which require too much effort to correct, in repo-specific file.

When point 3 occurs, then we lose the entire benefit of that rule, people likely to continue to write the non-desired code.

Rather than disabling a rule, it would be better to ignore the specific infractions of the current codebase, and only apply moving forward. This would ensure that new code at least follows the new standard.

In my mind, this could be accomplished by adding a feature to this tool. After choosing the rule to work on, a user could be presented with an "ignore lines" option in addition to the "fix" option. This would go insert line-level eslint ignore statements. I understand this is a little afield of what the tool currently does, but I don't see any other tools in the space able to help.

I would be interested in helping out, if this is a desired feature.

Seems to break regular eslint CLI

Hey awesome package, really useful for going through a big codebase rule by rule and fixing things.

However, I noticed that that after installing it, regular eslint linting via the CLI is not observing the .eslintrc properly.

Here's an example; prior to installing eslint-nibble the following code, correctly as per my config, does not throw an eslint error

static propTypes = {
  actions: PropTypes.object,
  children: PropTypes.any,
}

However, after installing eslint-nibble and then simply running eslint on this file I see

18:10 error 'propTypes' is not defined no-undef

Which is incorrect as per my rules. Running eslint-nibble however, correctly does not deem this to be an error. What's going on here?

Uninstalling eslint-nibble restores the ability for the regular eslint CLI command to lint correctly.

Respect .eslintignore file

Some files needed to be ignored by eslint-nibble (which already ignored eslint via .eslintignore), but now there are no ways to do it

Ability to define eslint rules

I have a .eslintrc file in my project with all the required rules. However, when running this it seems to ignore that file and display some standard errors based on what it thinks are the rules. How can i force it to use my set of rules?

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.