Skip to content

Conversation

@sirtimid
Copy link
Contributor

@sirtimid sirtimid commented Sep 10, 2024

Closes #50

Now, you can run lint commands within individual packages, and the root lint commands will invoke them as well.

Added these commands on package level:

lint 
lint:ci 
lint:dependencies 
lint:eslint 
lint:fix 
lint:misc 

based on the commands of https://github.com/MetaMask/snaps packages

Also removed some unused dependencies (the linter complained) and some unnecessary exceptions

@sirtimid sirtimid requested a review from a team as a code owner September 10, 2024 13:46
@sirtimid sirtimid requested a review from rekmarks September 10, 2024 13:47
@socket-security
Copy link

socket-security bot commented Sep 10, 2024

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: npm/@babel/parser@7.25.3, npm/@babel/types@7.25.2

View full report↗︎

@SMotaal
Copy link
Contributor

SMotaal commented Sep 10, 2024

For completeness, do we want to also add constraints in yarn.config.js?

        // All packages except the root must have the same "lint" scripts.
        expectWorkspaceField(
          workspace,
          'scripts.lint',
          'yarn lint:eslint && yarn lint:misc --check && yarn lint:dependencies',
        );
        expectWorkspaceField(workspace, 'scripts.lint:ci', 'yarn lint');
        expectWorkspaceField(
          workspace,
          'scripts.lint:dependencies',
          'depcheck',
        );
        expectWorkspaceField(
          workspace,
          'scripts.lint:eslint',
          'eslint . --cache --ext js,mjs,cjs,ts,mts,cts',
        );
        expectWorkspaceField(
          workspace,
          'scripts.lint:fix',
          'yarn lint:eslint --fix && yarn lint:misc --write',
        );
        expectWorkspaceField(
          workspace,
          'scripts.lint:misc',
          "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path .gitignore",
        );

Copy link
Contributor

@SMotaal SMotaal left a comment

Choose a reason for hiding this comment

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

@sirtimid This is to avoid needing to run lint:fix twice to get prettier (ie lint:misc) to correct the order in package.json files after yarn constraints --fix makes any needed changes.

This is specific for lint:fix where yarn constraints --fix will potentially make changes that would require reordering.

SMotaal
SMotaal previously approved these changes Sep 10, 2024
@sirtimid sirtimid requested a review from grypez September 10, 2024 15:26
Copy link
Contributor

@grypez grypez left a comment

Choose a reason for hiding this comment

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

Nearer, faster and prettier than before!

grypez
grypez previously approved these changes Sep 10, 2024
@sirtimid sirtimid dismissed stale reviews from grypez and SMotaal via 17abbad September 10, 2024 15:38
@sirtimid sirtimid force-pushed the sirtimid/package-level-lint-scripts branch from 17abbad to e1cc042 Compare September 10, 2024 15:48
@sirtimid sirtimid requested a review from SMotaal September 10, 2024 15:50
@sirtimid sirtimid requested a review from grypez September 10, 2024 15:50
Copy link
Contributor

@SMotaal SMotaal left a comment

Choose a reason for hiding this comment

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

✅ Reverting to changes previously approved!

@sirtimid sirtimid merged commit 4332fb3 into main Sep 10, 2024
@sirtimid sirtimid deleted the sirtimid/package-level-lint-scripts branch September 10, 2024 15:54
await rimraf(`${distDir}/*`, { glob: true });

generateEndoScriptBundle(
await generateEndoScriptBundle(
Copy link
Contributor

@SMotaal SMotaal Sep 11, 2024

Choose a reason for hiding this comment

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

@grypez thanks for noticing the problem and @sirtimid for noticing and fixing the error I introduced in #40: 1370add#diff-4065a37c0be83e49f87d53ebab76253143887ef81dc53ff132b0e7337a9ededdR23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: Add package level lint scripts

4 participants