Skip to content

feat: add linting jobs for JavaScript and CSS/SCSS in CI configuration#14

Merged
konradmichalik merged 3 commits intomainfrom
frontend-linter
Jul 24, 2025
Merged

feat: add linting jobs for JavaScript and CSS/SCSS in CI configuration#14
konradmichalik merged 3 commits intomainfrom
frontend-linter

Conversation

@konradmichalik
Copy link
Contributor

@konradmichalik konradmichalik commented Jul 24, 2025

Summary by CodeRabbit

  • New Features

    • Added automated JavaScript and TypeScript linting to the CI pipeline.
    • Added automated CSS/SCSS style linting to the CI pipeline.
  • Documentation

    • Updated the README to include the new analysis templates and corrected cache warmup paths.

@coderabbitai
Copy link

coderabbitai bot commented Jul 24, 2025

Warning

Rate limit exceeded

@jackd248 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 78aa016 and 67d0da1.

📒 Files selected for processing (3)
  • .gitlab-ci.yml.dist (2 hunks)
  • analyze/analyze-js-lint.yaml (1 hunks)
  • analyze/analyze-style-lint.yaml (1 hunks)

Walkthrough

Two new CI linting jobs for JavaScript/TypeScript and CSS/SCSS were added via dedicated YAML templates and included in the main CI configuration. The README was updated to document these new templates and to correct cache warmup YAML paths. No changes were made to exported or public entities in code.

Changes

File(s) Change Summary
.gitlab-ci.yml.dist Included two new CI templates: analyze-js-lint.yaml and analyze-style-lint.yaml under analyze.
analyze/analyze-js-lint.yaml Added new CI job analyze:js:lint for JavaScript/TypeScript linting with rules and dependencies.
analyze/analyze-style-lint.yaml Added new CI job analyze:style:lint for CSS/SCSS linting with rules and dependencies.
README.md Documented new analysis templates and corrected cache warmup YAML paths.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant GitLabCI as GitLab CI
    participant NodeBuild as build:node job
    participant JSJob as analyze:js:lint
    participant StyleJob as analyze:style:lint

    Dev->>GitLabCI: Push/trigger pipeline
    GitLabCI->>NodeBuild: Run build:node
    NodeBuild-->>GitLabCI: build:node complete
    GitLabCI->>JSJob: Run if .js/.ts changed (and rules met)
    GitLabCI->>StyleJob: Run if .scss changed (and rules met)
    JSJob-->>GitLabCI: JS lint results
    StyleJob-->>GitLabCI: Style lint results
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

In the warren where the code lines twine,
Two new linting jobs now shine—
JavaScript and styles, checked with care,
Ensuring code is crisp and fair.
Paths corrected, docs aligned—
A tidy burrow, peace of mind!
🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch frontend-linter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
.gitlab-ci.yml.dist (1)

10-15: Doc / config drift: README uses .yaml, .gitlab-ci.yml.dist mixes .yaml & .yml

New includes use .yaml extension, while existing ones still reference .yml.
Pick one convention to avoid broken links on future renames and keep the list alphabetically sorted for easier diffing.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f70295 and 78aa016.

📒 Files selected for processing (4)
  • .gitlab-ci.yml.dist (1 hunks)
  • README.md (2 hunks)
  • analyze/analyze-js-lint.yaml (1 hunks)
  • analyze/analyze-style-lint.yaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: yamllint

Comment on lines +7 to +14
analyze:js:lint:
image:
name: ${DEFAULT_IMAGE_BUILD_NODE}
stage: analyze
needs:
- build:node
script:
- npm run lint:js
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Missing dependency/artifact handshake with build:node job

The job declares

needs:
  - build:node

but does not declare dependencies: or an artifacts:/cache: section to actually re-use the node_modules artefact that build:node presumably produces.
Without it the job will install its own modules (or—worse—fail when the directory is absent), losing the caching benefit and doubling pipeline time.

 analyze:js:lint:
   ...
   needs:
     - build:node
+  dependencies:
+    - build:node         # reuse artefacts
+  artifacts:
+    reports: { }         # keep default
+    paths:
+      - node_modules/    # adjust to your build:node paths
🤖 Prompt for AI Agents
In analyze/analyze-js-lint.yaml around lines 7 to 14, the job declares a
dependency on build:node using needs but does not specify dependencies or
artifacts to reuse the node_modules produced by build:node. To fix this, add a
dependencies or artifacts section to explicitly fetch the node_modules artifact
from build:node, ensuring the lint job reuses the installed modules and benefits
from caching, preventing redundant installations and reducing pipeline time.

Comment on lines +15 to +23
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: always
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_COMMIT_TAG == null
changes:
- "**/*.js"
- "**/*.ts"
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Change-trigger glob is too narrow & rules ordering may disable MR feedback

  1. Only **/*.js & **/*.ts are watched – real-world repos often contain
    .jsx, .tsx, .mjs, .cjs, or config files (*.eslintrc, etc.).
  2. The earlier rule sets when: never for merge_request_event; developers lose lint feedback before merging.

Consider:

-    - if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "merge_request_event"
+    - if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "pipeline"
       when: never

and broaden the glob:

-        - "**/*.js"
-        - "**/*.ts"
+        - "**/*.{js,jsx,mjs,cjs,ts,tsx}"
+        - ".eslintrc*"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: always
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_COMMIT_TAG == null
changes:
- "**/*.js"
- "**/*.ts"
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: always
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "pipeline"
when: never
- if: $CI_COMMIT_TAG == null
changes:
- "**/*.{js,jsx,mjs,cjs,ts,tsx}"
- ".eslintrc*"
🤖 Prompt for AI Agents
In analyze/analyze-js-lint.yaml around lines 15 to 23, the file change trigger
globs only watch for .js and .ts files, missing other relevant extensions like
.jsx, .tsx, .mjs, .cjs, and config files such as .eslintrc. Also, the rule
ordering disables lint feedback on merge_request_event by setting when: never
too early. To fix this, broaden the file globs to include these additional
extensions and reorder or adjust the rules so that lint feedback is enabled
during merge_request_event pipelines.

Comment on lines +7 to +14
analyze:style:lint:
image:
name: ${DEFAULT_IMAGE_BUILD_NODE}
stage: analyze
needs:
- build:node
script:
- npm run lint:style
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Same artefact-reuse gap as JS lint job

Add dependencies: / artifacts: to reuse node_modules from build:node, mirroring the suggestion for the JS lint job.

🤖 Prompt for AI Agents
In analyze/analyze-style-lint.yaml around lines 7 to 14, the job is missing the
dependencies and artifacts configuration to reuse node_modules from the
build:node job. Add a dependencies section listing build:node and an artifacts
section specifying the path to node_modules to enable artifact reuse, similar to
the JS lint job setup.

Comment on lines 110 to 113
Includes:
- `test/cache-feature-warmup.yaml`
- `test/cache-prod-warmup.yaml`
- `cache/cache-feature-warmup.yaml`
- `cache/cache-prod-warmup.yaml`

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

README and CI config out of sync for cache warm-up templates

README lists

- cache/cache-feature-warmup.yaml
- cache/cache-prod-warmup.yaml

but .gitlab-ci.yml.dist still includes

test/cache-feature-warmup.yaml
test/cache-prod-warmup.yaml

Either the path change is incomplete or the docs are wrong – one of them must be updated to avoid broken includes and user confusion.

🤖 Prompt for AI Agents
In README.md around lines 110 to 113, the listed cache warm-up template paths do
not match those in the .gitlab-ci.yml.dist file, causing inconsistency. Verify
the correct paths for the cache warm-up templates and update either the README
or the .gitlab-ci.yml.dist file so both reference the same, correct file paths
to prevent broken includes and confusion.

@konradmichalik konradmichalik merged commit f5c1edd into main Jul 24, 2025
2 checks passed
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.

1 participant