ni / ni/javascript-styleguide

Improve experience when using ruleset in repo with mixed JS, TS, and Angular code

Open
#79 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation needs-proposal
Dominant language
JavaScript
Stars
9
Forks
11
PR merge metrics
No merged PRs in 30d

Description

In this Skyline PR I enabled linting for the JS files in an Angular project. This situation is common because of config files like karma.conf.js and .eslintrc.js. I hit a couple small bumps that would be nice to address in this repo.

  1. Had to manually modify the repo's .eslintrc.js to use the JavaScript ruleset for files matching *.js. We should either document this as our recommended approach or change our Angular and TS rulesets to apply to JS files too.
  2. I had to modify angular.json lintFilePatterns to include *.js since the npm run lint command called ng lint. We should document this.
  3. A few rules failed on the default karma.conf.js generated by Angular. I chose to suppress those rules. In another case we chose to fix them (see discussion in linked PR). It would be nice to settle on a preferred approach and include guidance in our repo since most projects will likely hit the same errors.
    • if we choose to suppress, we could change our ruleset to do this automatically for karma.conf.js
    • if we choose to fix, we could add notes on each rule's docs or create StackOverflow posts explaining how to fix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the repository's .eslintrc.js, angular.json, and generated karma.conf.js, then read the linked Skyline pull request and its discussion. Determine and document the preferred handling for mixed JS and TypeScript Angular projects, including lintFilePatterns and the reported Karma rule failures; done means the guidance or ruleset behavior is settled and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, eslint, javascript, typescript
Domain
documentation, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.