Skip to content

ESlint config generated by d2 style js install #52

Closed
@HendrikThePendric

Description

@HendrikThePendric

By starting this issue, I hope we can come to a decision about what sort of ESLint configuration should be produced by the d2-style package.

This is my personal take on it:

  • To me what we currently have doesn’t make sense: after you run d2 style js install you end up with a linter configuration without any base configuration.
  • We are predominantly writing react stuff, so using the react-app as a basis makes sense.
  • If you want something else: roll your own linter config.

So I would propose the following solution:

  • Add the line extends: 'react-app', to .eslintrc.js
  • And then add some optional argument to d2 style js install for when you are not in an app, but in a lib, i.e.: d2 style js install --withDependencies to make sure these packages installed:
    eslint-config-react-app babel-eslint@9.x eslint@5.x eslint-plugin-flowtype@2.x eslint-plugin-import@2.x eslint-plugin-jsx-a11y@6.x eslint-plugin-react@7.x eslint-plugin-react-hooks@1.5.0
    (https://www.npmjs.com/package/eslint-config-react-app)
  • Perhaps the install script can actually detect missing dependencies, and no argument is needed.

Since after the configuration is created you are free to do whatever you like, I think the above is fine.


@varl mentioned the following in Slack

i am a bit hesitant to add e.g. react specific rules there because we use js in multiple contexts and it is nice to be able to apply the same eslint rules across typescript, nodejs, es modules, react, etc.

So an alternative would be to support a set of configurations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions