Skip to content

Add extra eslint rules #541

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add extra eslint rules #541

wants to merge 2 commits into from

Conversation

bonnie57
Copy link
Collaborator

@bonnie57 bonnie57 commented May 16, 2025

Description

  1. Using a single import statement per module will make the code clearer because you can see everything being imported from that module on one line.

Example of incorrect code for this rule:

import { merge } from 'module';
import something from 'another-module';
import { find } from 'module'; //error

  1. Require default cases in switch statements

Example of incorrect code for this rule:

/*eslint default-case: "error"*/

switch (a) {
    case 1:
        /* code */
        break;
}
  1. Require the use of === and !==

Example of incorrect code for this rule:

if (x == 42) { }
  1. Require const declarations for variables that are never reassigned after declared

Example of incorrect code for this rule:

// it's initialized and never reassigned.
let a = 3;
console.log(a);

@bonnie57 bonnie57 changed the title Add ESLint rule to disallow duplicate imports Add extract eslint rules May 16, 2025
@bonnie57 bonnie57 changed the title Add extract eslint rules Add extra eslint rules May 16, 2025
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