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

Allow contributors to lint individual examples #573

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dotproto
Copy link
Contributor

Description

This PR introduces a new npm script: lint:cwd. This script allows contributors to run the linter against their current directory rather than against the entire repo.

Motivation

It was frustrating to try to filter npm run lint logs for only the files that were relevant to my PR.

Additional details

N/A

Related issues and pull requests

N/A

@Rob--W
Copy link
Member

Rob--W commented Nov 18, 2024

FYI: You can always run ./node_modules/.bin/eslint path/to/dir, or if you have a compatible global eslint install just plain eslint path/to/dir to lint specific directories.

@willdurand willdurand requested review from Rob--W and removed request for willdurand November 19, 2024 08:56
@Rob--W
Copy link
Member

Rob--W commented Nov 19, 2024

Note that there is an existing lint:fix task. I considered asking to duplicate it, but then recalled that you can do something like npm run lint:cwd -- --fix to achieve something similar.

Taking it one step further... Do you need this PR at all? Wouldn't npx eslint . do what you want (and is also shorter)?

@dotproto
Copy link
Contributor Author

Yes, npx eslint . would perform the same operation as the proposed lint:cwd script. I tend to think of npm scripts as the canonical commands a developer would use when contributing to a project; after you clone a new project, you can execute npm run to see what kind of scripts are provided. One useful function scripts provide in this capacity an abstraction over the actual commands required to perform a given task. If the project switched from using eslint to jshint, standard, or any other tool a contributor could continue using the same npm script and have the task run as expected.

Ultimately, though, I don't feel too strongly about this specific command. It seemed to me like it might be helpful, but if you disagree we can close out this PR.

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

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

No strong opinions either. It is simple and an improvement, so lgtm.

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.

2 participants