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
chore: consolidate eslint config #627
Conversation
I note that |
570d8b4
to
939792a
Compare
Worth mentioning there were multiple references to eslint rules from endo's custom config in |
939792a
to
ff6f77e
Compare
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
d4a1560
to
95f581c
Compare
f389c76
to
75e5442
Compare
@@ -0,0 +1,3 @@ | |||
ignores: | |||
# monorepo deps | |||
- "ava" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because depcheck
is not monorepo-aware, ava
will be referenced in e.g., lavapack/test/index.js
, but it will not appear in the devDependencies
of lavapack/package.json
.
any dev dep in a workspace which is required from code (unsure if this applies to dev deps only referenced in e.g., package.json
's scripts
prop) but is only in the workspace root's dev deps would need to be in this ignore
property.
75e5442
to
c283bb0
Compare
just gonna retarget this one to #629 |
c283bb0
to
0f27be3
Compare
cf45819
to
57df31b
Compare
9b9495d
to
62065a6
Compare
a753724
to
62bb6ea
Compare
62bb6ea
to
6ec7fce
Compare
6d08610
to
f69b08b
Compare
6ec7fce
to
6657c9b
Compare
227df10
to
2b1eb8e
Compare
.eslintrc.js
Outdated
'n/no-process-env': 0, | ||
// this rule seems broken | ||
'n/no-unpublished-require': 0, | ||
// we should probably actually fix these three and disable this override. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q for later: What's the upside of n/no-process-exit
here? Agreed on the two other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure exactly what you're asking. process.exit()
can be problematic if any of your code is async, because it exits before the loop is clear. It's safer to just let the event loop die. Anyway; it's in the codebase, and I didn't want to remove it, so I disabled the rule for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a rebase before merge but LGTM otherwise!
4b5f6fc
to
9f11a04
Compare
This change: - Removes all `.eslintignore` , `.eslintrc` files or `package.json`-embedded config and replaces it with a single root `.eslintrc.js` - Removes all lint-related scripts from all workspaces (including `depcheck`) - Removes all dev deps on `eslint` and its ilk (and `ava`, since it will come from the workspace root) - Upgrades `@metamask/eslint-config-nodejs`, `eslint`, `eslint-plugin-ava`, as well as other plugins used by specific packages; moves them all to workspace root - Removes unused/deprecated `eslint-plugin-node` in lieu of `eslint-plugin-n`, which the new version of `@metamask/eslint-config-nodejs` needs - Adds a prettier config (in case someone wants to use it; I'd like to add it to our workflow later) I note that ESLint seemed to be misconfigured before this change; none of the rules specified in the root config were being checked. This means that there are a whole lot of lint fixes that need to be made. To lint, run `yarn lint` as before (which will also run `depcheck`) from the workspace root. Likewise, `lint:fix` runs a fix, and `lint:depcheck` will use lerna to run `lint:depcheck` wherever it is defined.
9f11a04
to
5e27065
Compare
Closes #637 This removes the dep on `@metamask/eslint-config-nodejs` which has a peer dep on `@metamask/eslint-config`. `npm` will automatically install that module, and that module _itself_ has peer deps which may also conflict with our deps currently or in the future. Given `@metamask/eslint-config-nodejs` is _intended_ to be used with `@metamask/eslint-config`, we then must drop it. The ESLint config has been modified to extend both `eslint/recommended` and `eslint-plugin-n/recommended` configs. Extra rules were copied from `@metamask/eslint-config-nodejs`, but many (such as restrictions on browser-only globals) were not, since these can be trivially addressed by ESLint's `env` configuration (unsure what they are doing where this is a problem). Since this surfaced a whole lot of new issues--especially in test code and templates--additional overrides were necessary. Any rules which were removed from the main `rules` prop were likely already enabled in `eslint/recommended`. # Conflicts: # package-lock.json # package.json
This change: - Removes all `.eslintignore` , `.eslintrc` files or `package.json`-embedded config and replaces it with a single root `.eslintrc.js` - Removes all lint-related scripts from all workspaces (including `depcheck`) - Removes all dev deps on `eslint` and its ilk (and `ava`, since it will come from the workspace root) - Upgrade `eslint`, `eslint-plugin-ava`, as well as other plugins used by specific packages; moves them all to workspace root - Removes unused/deprecated `eslint-plugin-node` in lieu of `eslint-plugin-n` - Adds a prettier config (in case someone wants to use it; I'd like to add it to our workflow later) I note that ESLint seemed to be misconfigured before this change; none of the rules specified in the root config were being checked. This means that there are a whole lot of lint fixes that need to be made. To lint, run `yarn lint` as before (which will also run `depcheck`) from the workspace root. Likewise, `lint:fix` runs a fix, and `lint:depcheck` will use lerna to run `lint:depcheck` wherever it is defined. chore: remove @metamask/eslint-config-nodejs (LavaMoat#639) Closes LavaMoat#637 This removes the dep on `@metamask/eslint-config-nodejs` which has a peer dep on `@metamask/eslint-config`. `npm` will automatically install that module, and that module _itself_ has peer deps which may also conflict with our deps currently or in the future. Given `@metamask/eslint-config-nodejs` is _intended_ to be used with `@metamask/eslint-config`, we then must drop it. The ESLint config has been modified to extend both `eslint/recommended` and `eslint-plugin-n/recommended` configs. Extra rules were copied from `@metamask/eslint-config-nodejs`, but many (such as restrictions on browser-only globals) were not, since these can be trivially addressed by ESLint's `env` configuration (unsure what they are doing where this is a problem). Since this surfaced a whole lot of new issues--especially in test code and templates--additional overrides were necessary. Any rules which were removed from the main `rules` prop were likely already enabled in `eslint/recommended`. chore: lint everything
This change: - Removes all `.eslintignore` , `.eslintrc` files or `package.json`-embedded config and replaces it with a single root `.eslintrc.js` - Removes all lint-related scripts from all workspaces (including `depcheck`) - Removes all dev deps on `eslint` and its ilk (and `ava`, since it will come from the workspace root) - Upgrade `eslint`, `eslint-plugin-ava`, as well as other plugins used by specific packages; moves them all to workspace root - Removes unused/deprecated `eslint-plugin-node` in lieu of `eslint-plugin-n` - Adds a prettier config (in case someone wants to use it; I'd like to add it to our workflow later) I note that ESLint seemed to be misconfigured before this change; none of the rules specified in the root config were being checked. This means that there are a whole lot of lint fixes that need to be made. To lint, run `yarn lint` as before (which will also run `depcheck`) from the workspace root. Likewise, `lint:fix` runs a fix, and `lint:depcheck` will use lerna to run `lint:depcheck` wherever it is defined. chore: remove @metamask/eslint-config-nodejs (LavaMoat#639) Closes LavaMoat#637 This removes the dep on `@metamask/eslint-config-nodejs` which has a peer dep on `@metamask/eslint-config`. `npm` will automatically install that module, and that module _itself_ has peer deps which may also conflict with our deps currently or in the future. Given `@metamask/eslint-config-nodejs` is _intended_ to be used with `@metamask/eslint-config`, we then must drop it. The ESLint config has been modified to extend both `eslint/recommended` and `eslint-plugin-n/recommended` configs. Extra rules were copied from `@metamask/eslint-config-nodejs`, but many (such as restrictions on browser-only globals) were not, since these can be trivially addressed by ESLint's `env` configuration (unsure what they are doing where this is a problem). Since this surfaced a whole lot of new issues--especially in test code and templates--additional overrides were necessary. Any rules which were removed from the main `rules` prop were likely already enabled in `eslint/recommended`. chore: lint everything
The resulting config is my best guess at the intent of the current configuration. In addition to linting the repo (the "lint everything" commit), this change:
.eslintignore
,.eslintrc
files orpackage.json
-embedded config and replaces it with a single root.eslintrc.js
depcheck
)eslint
and its ilk (andava
, since it will come from the workspace root)@metamask/eslint-config-nodejs
,eslint
,eslint-plugin-ava
, as well as other plugins used by specific packages; moves them all to workspace rooteslint-plugin-node
in lieu ofeslint-plugin-n
, which the new version of@metamask/eslint-config-nodejs
needsI note that ESLint seemed to be misconfigured before this change; none of the rules specified in the root config were being checked. This means that there are a whole lot of lint fixes that need to be made.
To lint, run
npm run lint
(which will also rundepcheck
) from the workspace root. Likewise,lint:fix
runs a fix (across the whole repo), andlint:depcheck
will use lerna to runlint:depcheck
wherever it is defined.