mediamonks / frontend-coding-standards

Media.Monks - Frontend Coding Standards
60 stars 23 forks source link

Eslint config #6

Closed ThijsTyZ closed 3 years ago

ThijsTyZ commented 4 years ago

This adds an Eslint Configuration Extension. This configuration has all eslint settings for React, Vue and Muban projects.

When installing this as an NPM library the .eslintrc.js can just be:

module.exports = {
  extends: ['@mediamonks']
};
ThijsTyZ commented 4 years ago

With the popularity of Code .vscode would be a good addition

a good addition for what?

psimk commented 4 years ago

what about eslint-plugin-jsx-a11y ? This would also work for using JSX within Vue. My thinking is that, instead of accessibility being an afterthought, this plugin could at least guide us into a somewhat correct right direction from the get go. This could save time for both us and QA.

psimk commented 3 years ago

Typescript from version 3.8 supports import type, @typescript-eslint/eslint-plugin has a rule @typescript-eslint/consistent-type-imports that prevents types from being imported without the type prefix. This can rule can be quite invaluable when trying to restrict importing TS modules. Example being webpack dynamic bundle splitting.

ThaNarie commented 3 years ago

@psimk TS itself also has an option (importsNotUsedAsValues) that throws errors, do we want both TS and eslint to complain? (Also, see #12)

psimk commented 3 years ago

@ThaNarie importsNotUsedAsValues would throw an error, but would it be auto-fixed? With the eslint rule we can at least guarantee that the rule won't trip over the developer and be auto-fixed, while still doing work in the IDE.