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.

Make ESLint configuration flexible

See original GitHub issue

Is your proposal related to a problem?

Setting up ESLint is always a pain point in CRA. For most of the time, everything seems to work fine, right until I run a separate lint check command like eslint 'src/**/*.js', then I realize that the eslint result return by the CRA is incomplete/broken, and the root cause is mainly because of the CRA is fixing version for certain eslint related package, for instance, @typescript-eslint/parser. And so far, my workaround is to use tools like craco + craco-eslint-webpack-plugin to replace the entire eslint module in CRA, it’s hacky but works great for me. And as we all know things break by using tools like this.

Describe the solution you’d like

Make the eslint configuration even flexible, don’t include default eslint setup/packages by default. And yes I know, things will break, but it’s just problematic the current eslint setup, let us the developers handle the problem.

Describe alternatives you’ve considered

At least don’t fix the eslint package like @typescript-eslint/parser, etc.

Additional context

None

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:8
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
patricklafrancecommented, Dec 8, 2020

Not true anymore @chungweileong94 😃 We released https://www.npmjs.com/package/@craco/craco/v/6.0.0 this morning which add support for CRA 4 🥳 🥳

0reactions
chungweileong94commented, Dec 1, 2020

@chungweileong94 mind sharing your craco setup to accomplish this? That could come in handy until we have a real solution

I don’t have a good repo to represent my craco setup, but I can share with you my current craco.config.js

/* eslint-disable import/no-extraneous-dependencies */
const CracoAlias = require('craco-alias');
const FastRefreshCracoPlugin = require('craco-fast-refresh');
const CracoESLintWebpackPlugin = require('craco-eslint-webpack-plugin');

module.exports = {
  plugins: [
    {
      plugin: CracoAlias,
      options: {
        source: 'tsconfig',
        baseUrl: './src',
        tsConfigPath: './tsconfig.extend.json',
      },
    },
    {
      plugin: FastRefreshCracoPlugin,
    },
    {
      plugin: CracoESLintWebpackPlugin,
      options: {
        skipPreflightCheck: true,
        eslintOptions: {
          files: 'src/**/*.{js,ts,tsx}',
          lintDirtyModulesOnly: true,
          emitWarning: true,
        },
      },
    },
  ],
};

Do note that the craco is only supported CRA 3 at the moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring ESLint - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
WebStorm 2020.3 EAP #4: More Flexible ESLint Configuration ...
We've added the ability to turn plugins on and off for specific projects only, which should make it easier for you to configure...
Read more >
A Bit On ESLint Configuration In A React Project - Medium
After having used ESLint configuration from starter templates and ... To me, the .js format seems the most flexible so I'm not sure...
Read more >
Set Up ESLint - The newline Guide to Modernizing an ...
Fun fact: Create React Apps already comes with some more generic ESLint ... use an already-defined ESLint config as a starting point and...
Read more >
Eslint setup | Mashup Garage Playbook
Make sure react/prop-types is disabled in the eslintrc configuration. We discourage the use of prop types; instead, please consider adding TypeScript for robust ......
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