Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Initial implementation of shared eslint config#1

Closed
bajtos wants to merge 2 commits intomainfrom
initial-impl
Closed

Initial implementation of shared eslint config#1
bajtos wants to merge 2 commits intomainfrom
initial-impl

Conversation

@bajtos
Copy link
Member

@bajtos bajtos commented Apr 10, 2025

Copy the Neostandard eslint config from https://github.com/CheckerNetwork/node

See CheckerNetwork/node#710

Copy the Neostandard eslint config from https://github.com/CheckerNetwork/node

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
@bajtos bajtos requested a review from juliangruber April 10, 2025 14:01
- env
- ignores

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
Comment on lines +3 to +6
export default neostandard({
noStyle: true, // Disable style-related rules, we use Prettier
ts: true,
})
Copy link
Member Author

Choose a reason for hiding this comment

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

I am not convinced that sharing a two-line configuration is worth the extra ceremony required. (This patch has +4,949 new lines.)

We will also need to remember to periodically publish new versions of this package in order to ship neostandard updates to our repositories.

@juliangruber WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

package-lock.json is adding 4,808 lines, so the actual meaningful content is "only" 141 lines. To share eslint.config.js containing six lines of code 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I don't see it this way, the PR is already there and the extra code is basic orchestration. There are many repositories where the extra code is so much more than the actual code. We might also develop the eslint config in the future, or perform tooling upgrades. We don't want to do this in every repo one by one.

Copy link
Member

Choose a reason for hiding this comment

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

I do wonder though if there's a better way to share this config

Copy link
Member

Choose a reason for hiding this comment

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

For one, can we share the eslint and prettier config from one repo? This way there's half the orchestration, and less updates. It gets closer to my desire of having just one package for all things listing & formatting.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking about this quite a bit.

Neostandard is already the shared linter config that shields us from the details of eslint configuration. The two tweaks we need to make - enable ts and disable style - are kind of specific to each repository. I don't expect them to change unless we significantly rework our formatting & linting setup.

The situation with Prettier is more complex; we need our custom shared config. Prettier provides a neat solution for that:

{
  "prettier": "@CheckerNetwork/prettier-config"
  "devDependencies": {
    "@CheckerNetwork/prettier-config": "^1.0.0",
    "prettier": "^3.5.3"
  }
}

Is it worth innovating here? I am happy to follow the default Prettier approach.

For one, can we share the eslint and prettier config from one repo?

It's not the typical path supported by Prettier.

I see two potential options we can explore:

  • In package.json, add `"prettier": "@CheckerNetwork/lint-config/prettier" - if Prettier supports importing from package sub-paths
  • Use .prettierrc.js file that re-exports only the Prettier part of the shared configuration

I am not convinced the benefit of having one repo combining eslint and Prettier config is worth deviating from the typical path, though. These two configurations are independent (as long as we keep eslint style-rules disabled).

Copy link
Member

Choose a reason for hiding this comment

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

Got it, if that's not supported, let's not innovate. +1 to inlining the neostandard config, and using one repo for the prettier config

Copy link
Member

Choose a reason for hiding this comment

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

I want to go the overall simplest path possible here

@bajtos bajtos changed the title Initial implementation Initial implementation of shared eslint config Apr 14, 2025
Copy link
Member

Choose a reason for hiding this comment

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

Alleviating your concerns about PR size a bit, this file can be removed as we make this repo also depend on the shared prettier config

Comment on lines +3 to +6
export default neostandard({
noStyle: true, // Disable style-related rules, we use Prettier
ts: true,
})
Copy link
Member

Choose a reason for hiding this comment

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

I don't see it this way, the PR is already there and the extra code is basic orchestration. There are many repositories where the extra code is so much more than the actual code. We might also develop the eslint config in the future, or perform tooling upgrades. We don't want to do this in every repo one by one.

@@ -1,2 +1,11 @@
# eslint-config

Shared configuration for ESLint based on Neostandard
Copy link
Member

Choose a reason for hiding this comment

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

This is missing docs for how to use this config, could you add that too?

Comment on lines +3 to +6
export default neostandard({
noStyle: true, // Disable style-related rules, we use Prettier
ts: true,
})
Copy link
Member

Choose a reason for hiding this comment

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

I do wonder though if there's a better way to share this config

Comment on lines +3 to +6
export default neostandard({
noStyle: true, // Disable style-related rules, we use Prettier
ts: true,
})
Copy link
Member

Choose a reason for hiding this comment

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

For one, can we share the eslint and prettier config from one repo? This way there's half the orchestration, and less updates. It gets closer to my desire of having just one package for all things listing & formatting.

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.

2 participants