question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor inline config comment processing out of lib/eslint.js

See original GitHub issue

I’ve mentioned this in a couple of different issues (#6435, #6190), but I think we should consider moving inline configuration comment processing out of lib/eslint.js. This will make consideration of those other issues a little easier.

The main purpose of this issue (at time of posting) is to lay out a proposal and hopefully get an idea of when it will land on the roadmap. I’m aware that we have other items on the roadmap that may have higher priority. This issue is just so that when we decide we want to do it, we have some concrete notes and discussion that will help. (That said, I’m also interested in implementing if it might make it happen sooner.)

Proposal:

  1. Create new ReportFilter module which will take responsibility for filtering lint reports (determined by config comments).
  2. Extract lib/eslint.js’ disableReporting into a ReportFilter API which would create an unbounded report disable range for each specified rule. (No real change in functionality)
  3. Extract lib/eslint.js’ enableReporting into a ReportFilter API which would add an end range to the latest-in-file report disable range last created for each specified rule. (No real change in functionality)
  4. Extract lib/eslint.js’ isDisabledByReportingConfig into a ReportFilter API which would check the rule ID and location against disable ranges for the file and return a boolean. (No real change in functionality)
  5. Add unit tests for the same.

Goal is to try to do this in such a way that we can also track uses of those disable ranges and have the code be transparent and maintainable, while reducing the complexity and responsibilities of lib/eslint.js.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
platinumazurecommented, Aug 2, 2016

Just leaving a note here that I want to get to this pretty soon (maybe in the second half of August), but that I’m going to try to knock out a few JSCS compat issues first.

0reactions
platinumazurecommented, May 23, 2017

It’s somewhere on my to-do list… It might not be as big a deal anymore if we create a Linter class in its own file, so if nothing else I’ll evaluate that PR and see if this might still be needed.

On May 22, 2017 9:20 PM, “Teddy Katz” notifications@github.com wrote:

Is this still something we’re planning to do?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/eslint/eslint/issues/6592#issuecomment-303271541, or mute the thread https://github.com/notifications/unsubscribe-auth/AARWeueYiOUj2_-UbfWb6aSW6YOcPRPpks5r8kJtgaJpZM4JEfrU .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refactoring JavaScript | WebStorm Documentation - JetBrains
Refactoring means updating the source code without changing the behaviour of the application. Refactoring helps you keep your code solid, ...
Read more >
node_modules/eslint/CHANGELOG.md · master - PLMlab
0acdefb Chore: refactor code (#12113) (James George) ... 558ccba Chore: refactor directive comment processing (#10007) (Teddy Katz) ...
Read more >
refactoring a code with inline JavaScript - Stack Overflow
I'm trying to refactor this w3schools for a toggleable tabs code because all of us know that using inline JavaScript is a very...
Read more >
Diff - 402e1b6e55e9041dfd1a93580e45e5c5dba1db55^!
eslint/bin/eslint.js \ No newline at end of file ... Add options to func-names config comments (#6748) (Brandon Mills) +* 2f94443 Docs: fix ...
Read more >
Comparing v8.29.0...v8.30.0 · eslint/eslint · GitHub - Easy
Find and fix problems in your JavaScript code. ... `allowInlineConfig` - (optional) set to `false` to disable inline comments from changing ESLint rules....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found