Skip to content

Improve lint configuration strategy #60

@randycoulman

Description

@randycoulman

Our current strategy for dealing with lint configuration is not ideal and needs to be improved.

Background

There are (at least) three places we need to be able to run eslint:

  • From the command-line via yarn lint
  • Within a text editor such as Atom
  • Via the eslint webpack loader (shows up when running yarn start and in the browser console)

The original react-scripts only supports the last mechanism (running via eslint-loader); we've added the first two with customizations in our @zeal/react-scripts fork.

Current Strategy

  • @zeal/react-scripts contains all of the lint-related dependencies
  • @zeal/react-scripts provides a lint script to run the linter using its own dependencies
  • @zeal/react-scripts contains no lint configuration of its own; it relies on eslint's ability to search up a file tree to find a configuration file. The host project generally defines this configuration.

Requirements

  • We want to be able to resolve imports relative to our app's client directory.
  • Client applications should be able to define local rule configuration overrides.
  • Client applications should be able to install more eslint plugins and use them in their configurations.
  • The client application and @zeal/react-scripts should not have to duplicate installed packages or configuration files.

Issues

Ideas

  • Consider switching to babel-plugin-module-resolver and its associated eslint resolver to resolve imports relative to client instead of using webpack to do this.

  • Consider moving all of the lint dependencies to the client project, removing them from @zeal/react-scripts. This may not work with the eslint-loader.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions