Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove eslint-config-airbnb* dependencies #160

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"comment": "refactor: extract eslint-config-airbnb rules",
"type": "patch",
"packageName": "@rightcapital/eslint-config-base",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"comment": "refactor: extract eslint-config-airbnb rules",
"type": "patch",
"packageName": "@rightcapital/eslint-config-typescript-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"comment": "refactor: extract eslint-config-airbnb rules",
"type": "patch",
"packageName": "@rightcapital/eslint-plugin",
"email": "[email protected]",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"change": "beachball change --no-commit",
"check": "beachball check",
"commit": "cz",
"dev": "tsc --build --watch",
"fix": "concurrently 'pnpm:fix:*' \"pnpm --filter './specs/*' fix\"",
"fix:eslint": "eslint --fix .",
"fix:prettier": "prettier --write --list-different .",
Expand Down
9 changes: 6 additions & 3 deletions packages/eslint-config-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
},
"dependencies": {
"@rushstack/eslint-patch": "1.10.3",
"eslint-config-airbnb-base": "15.0.0",
"confusing-browser-globals": "1.0.11",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-import": "npm:[email protected]",
"eslint-plugin-simple-import-sort": "12.1.0",
"eslint-plugin-unicorn": "54.0.0"
"eslint-plugin-unicorn": "54.0.0",
"semver": "7.6.2"
},
"devDependencies": {
"@rightcapital/tsconfig": "workspace:*"
"@rightcapital/tsconfig": "workspace:*",
"@types/confusing-browser-globals": "1.0.3",
"@types/semver": "7.5.8"
Comment on lines +36 to +37
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider moving these two dependencies to dependencies section?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are not reexporting these types; It is not very necessary to do so IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cc @liby What do you think ? 👀

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I would prefer to have the package and its type definition in the same section.

Copy link
Contributor

Choose a reason for hiding this comment

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

Moving type definition packages to dependencies can cause unnecessary bloat and version conflicts in production. It's generally better to keep them in devDependencies to avoid these issues, unless runtime type definitions are specifically needed. This keeps the dependency tree cleaner and more manageable.

Copy link
Contributor

Choose a reason for hiding this comment

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

After discussion, moving @types/* to dependencies does not have any obvious issues. This is more like a style preference issue:

  1. I prefer to put type packages that are not exported in devDependencies.

  2. I prefer to put the type package and its package together.

This reminds me of discussions about indentation, and if we want to choose a style preference, we can only vote within the entire team 🥹

},
"peerDependencies": {
"eslint": "^8.23.1"
Expand Down
10 changes: 9 additions & 1 deletion packages/eslint-config-base/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ require('@rushstack/eslint-patch/modern-module-resolution');

const config: Linter.Config = {
extends: [
require.resolve('eslint-config-airbnb-base'),
require.resolve('./rules/best-practices'),
require.resolve('./rules/errors'),
require.resolve('./rules/node'),
require.resolve('./rules/style'),
require.resolve('./rules/variables'),
require.resolve('./rules/es6'),
require.resolve('./rules/imports'),
require.resolve('./rules/strict'),
require.resolve('eslint-config-prettier'),
],
plugins: ['simple-import-sort', 'unicorn'],
env: { es6: true },
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
Expand Down
Loading