Skip to content

Correct eslint command in lint script #2570

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

Merged
merged 2 commits into from
Nov 19, 2024
Merged

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Nov 19, 2024

Motivation

The lint script of the "arduino-ide-extension" package is intended to use the ESLint linter tool to check for problems in all the package's JavaScript and TypeScript code files. It is used by the continuous integration system to validate contributions:

- name: Lint
run: |
yarn \
--cwd arduino-ide-extension \
lint

Previously, the command invoked eslint without any arguments. With the 8.x version of ESLint used by the project, it is necessary to provide a path argument in order to cause it to lint the contents of files (support for linting all files when the argument is omitted was added in 9.0.0). Because that argument was not provided, the script didn't do anything at all and so would return a 0 exit status even if the code had linting rule violations.

Change description

Add a . path argument to the command invoked by the script. This will cause ESLint to recurse through the arduino-ide-extension folder and lint the code in all relevant files.

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

The `lint` script of the "arduino-ide-extension" package is intended to use the ESLint linter tool to check for problems
in all the package's JavaScript and TypeScript code files. It is used by the continuous integration system to validate
contributions.

Previously, the command invoked `eslint` without any arguments. With the 8.x version of ESLint used by the project, it
is necessary to provide a path argument in order to cause it to lint the contents of files. Because that argument was
not provided, the script didn't do anything at all and so would return a 0 exit status even if the code had linting rule
violations.

This is fixed by adding a `.` path argument to the command invoked by the script. This will cause ESLint to recurse
through the `arduino-ide-extension` folder and lint the code in all relevant files.
It is considered good practice to use JavaScript's type-safe strict equality operator === instead of the equality
operator ==. Compliance with this practice is enforced by the project's ESLint configuration, via the "eqeqeq" rule.

The script used to generate the changelog for Arduino IDE's auto-update dialog contained an inappropriate usage of the
equality operator. This caused linting runs to fail:

arduino-ide-extension/scripts/compose-changelog.js
  37:19  error  Expected '===' and instead saw '=='  eqeqeq
@per1234 per1234 added topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project labels Nov 19, 2024
@per1234 per1234 self-assigned this Nov 19, 2024
@per1234 per1234 merged commit d377d00 into arduino:main Nov 19, 2024
32 checks passed
@per1234 per1234 deleted the fix-lint-command branch November 19, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant