Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Linting #127

Merged
merged 9 commits into from
Nov 27, 2020
Merged

Linting #127

merged 9 commits into from
Nov 27, 2020

Conversation

oliverlloyd
Copy link
Contributor

@oliverlloyd oliverlloyd commented Nov 19, 2020

What does this change?

Well, this mushroomed.

Originally a PR to add linting it grew into adding additional config packages to get linting to work and then I had to do that thing where you have to solve all the linting errors causing a cascade of changes.

What linting errors were there?

Most changes were classic things like single quotes vs. double or spacing but the recommended configuration for @guardian repos also has things like no default exports which caused errors here too

I also updated the scripts section of package.json, giving:

    "lint": "eslint . --ext .ts,.tsx",
    "test": "jest",
    "tsc": "tsc",
    "validate": "npm run lint && npm run test && npm run tsc",

@oliverlloyd oliverlloyd changed the title Eslint Linting Nov 19, 2020
Copy link
Contributor

@mxdvl mxdvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need both .eslintrc and .prettierrc?

Should we also add the .editorconfig? https://github.com/guardian/configs/blob/main/.editorconfig

Comment on lines -11 to -13
export { default as BodyImage } from './components/bodyImage';
export { default as FigCaption } from './components/figCaption';
export { default as Img } from './components/img';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same file further up, we're already doing export { Role } from './image'; so export { Img } from './components/img'; should work the same.

@oliverlloyd
Copy link
Contributor Author

Do you need both .eslintrc and .prettierrc?

To be honest, I've never really got my head around how and where eslint and prettier overlap. I'm used to having the two different config files though and the onfigs repo seems to take the same approach so I'm happy to defer to the standard path

Should we also add the .editorconfig? https://github.com/guardian/configs/blob/main/.editorconfig

I think this makes sense. We could perhaps bring this in in a different PR to try to limit the noice from this one

@mxdvl
Copy link
Contributor

mxdvl commented Nov 20, 2020

Glad I'm not the only one struggling to grasp the distinction between Prettier and ESLint 😆

I think it should be set up so that prettier runs after ESLint, possibly triggered by it.

Copy link

@gtrufitt gtrufitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆒

@oliverlloyd
Copy link
Contributor Author

Linting for IR

@oliverlloyd oliverlloyd merged commit cab1684 into main Nov 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants