๐Ÿ“œ Sharable eslint configuration rimac technology uses in all of its projects.

Overview

Eslint Config

Commitizen friendly Conventional Changelog semantic-release: angular

Usage

  1. Install the library as a dev dependency alongside required dependencies using
yarn add -D
    @rimac-technology/eslint-config
    eslint
  1. Set up the minimal required configuration as displayed below

Minimal Required Configuration

  1. Create a new file in the root of the project called .eslintrc.json
  2. Place the following inside
{
    "extends": ["@rimac-technology/eslint-config/core"],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "project": "./tsconfig.json"
    }
}
  1. Make sure the project field (under parserOptions) is pointing to the correct path to your tsconfig.json

Optional Rulesets

Add the following ruleset to your .eslintrc.json file under extends section (example below)

  • "@rimac-technology/eslint-config/react"
  • "@rimac-technology/eslint-config/jest"
  • "@rimac-technology/eslint-config/type-graphql"
  • "@rimac-technology/eslint-config/mobx"
  • "@rimac-technology/eslint-config/testing-library" *See usage below

Using Optional Rulesets

General

  • The following is added to .eslintrc.json
{
    "extends": [
        "@rimac-technology/eslint-config/core",
        "@rimac-technology/eslint-config/<optional-ruleset-name>"
    ]
}

Testing Library

  • If you prefer more granular control of which files eslint-plugin-testing-library considers for test files and lints you can change "files" field.
{
    "overrides": [
        {
            "files": [
                "**/__tests__/**/*.[jt]s?(x)",
                "**/?(*.)+(spec|test).[jt]s?(x)"
            ],
            "extends": ["@rimac-technology/eslint-config/testing-library"]
        }
    ]
}

Turn on ESLint in your Project

Intellij

  1. Go to File>Settings>Languages & Frameworks>Javascript>Code Quality Tools>ESLint
  2. Select Automatic ESLint Configuration
  3. Check run eslint --fix on save
  4. Apply settings

Overriding or Adding Custom Rules

Rules can be overridden by adding them to the rules section in .eslintrc.json like the following example

{
    "extends": ["@rimac-technology/eslint-config/core"],
    "rules": {
        "space-infix-ops": "off"
    }
}

Troubleshooting

Little fellow sometimes has problems. Here is how to help if it doesn't work:

  1. Delete node_modules
  2. Go to File>Invalidate Caches>Invalidate and Restart
  3. Reinstall dependencies
  • Check if it works from the terminal. If it does, you IDE might be the problem here.

Testing Locally

In package.json, specify the path to the folder where you cloned eslint-config on your computer and place it instead of the version.

Then you can use it like any other lib.

  • Default install
// Current
{
    "@rimac-technology/eslint-config": "^19.0.0"
}
  • Local install for testing
{
    "@rimac-technology/eslint-config": "../eslint-config"
}
Comments
  • no-unnecessary-condition error  with valid condition

    no-unnecessary-condition error with valid condition

    Issues

    • [X] I have checked existing issues and there are no issues with the same problem.

    eslint-config-rimac Version You Are Using

    26.0.1

    Your Config

    {
        "extends": [
            "@rimac-technology/eslint-config/core",
            "@rimac-technology/eslint-config/react"
        ],
        "parser": "@typescript-eslint/parser",
        "parserOptions": {
            "project": "./tsconfig.json"
        },
        "ignorePatterns": [
            "**/node_modules",
            "**/*.generated.ts",
            "**/*.json",
            "**/*.gql"
        ],
        "overrides": [
            {
                "files": [
                    "**/cypress/**/*.{cy,cy.helper}.ts"
                ],
                "plugins": [
                    "cypress"
                ],
                "rules": {
                    "cypress/assertion-before-screenshot": "error",
                    "cypress/no-assigning-return-values": "error",
                    "cypress/no-async-tests": "error",
                    "cypress/no-unnecessary-waiting": "error",
                    "cypress/no-pause": "error",
                    "promise/catch-or-return": "off",
                    "promise/no-nesting": "off"
                }
            }
        ],
        "rules": {
            "etc/no-deprecated": [
                "error",
                {
                    "ignored": {
                        "preProcessSnapshot": "name",
                        "postProcessSnapshot": "name",
                        "returnValue": "name"
                    }
                }
            ]
        }
    }
    

    Steps to reproduce

    • Add "noUncheckedIndexedAccess": true to your tsconfig.json file
    • Get value by indexing an array or object
    • Check for null or undefined with nullish coalescing operator ??

    Expected behavior

    No eslint errors

    Actual behavior

    Got no-unnecessary-condition error

    MicrosoftTeams-image (3)

    but value can be undefined

    MicrosoftTeams-image (4)

    Requirements

    • [X] I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.
    ๐Ÿ› Bug 
    opened by andro-bosnjak 1
  • Setup CI to test all the rulesets are valid and runnable

    Setup CI to test all the rulesets are valid and runnable

    There should be a small snippet of code that would be linted with all the rules activated.

    If there are any issues with any of the rules, the lint should fail to report that rule XX can't be found or is invalid.

    https://github.com/tunnckoCore/eslint-config-charlint/blob/master/test.js

    ๐ŸŽ Feature released 
    opened by vuki656 1
  • New Rules

    New Rules

    • [x] https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/space-before-blocks.md
    • [x] https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-useless-empty-export.md
    • [x] https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-redundant-type-constituents.md
    • [x] https://eslint.org/docs/rules/lines-between-class-members
    • [x] https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md
    released Ruleset: ๐Ÿ“ฆ Core ๐Ÿ“ New Rules 
    opened by vuki656 1
  • New repo for prettier with package json sort

    New repo for prettier with package json sort

    prettier-plugin-packagejson or see if there are simmilar solutions with eslint

    https://github.com/kellyselden/eslint-plugin-json-files#supported-rules

    ๐ŸŽ Feature 
    opened by vuki656 0
  • Ignore line length in test descriptions

    Ignore line length in test descriptions

    Currently, eslint reports an error if it('should bla bla line in tests exceeds the max-len of 120 characters. As there is no way to go around this in a clean way, max-len rule should skip checking the it('should bla bla lines.

    If there is a it('should bla bla line in tests that exceeds the max-len of 120 chars, it should not be reported by eslint.

    ๐Ÿ› Bug Ruleset: ๐Ÿ“ฆ Core 
    opened by vuki656 0
  • Invalid nullable-output-type strictness

    Invalid nullable-output-type strictness

    Currently, invalid-nullable-output-type rule forces you to use Type | null if the field is decorated with { nullable: true.

    Sometimes using name?: Type | null is also required.

    The rule should be adjusted to not error when using undefined

    ๐Ÿ› Bug Ruleset: โš›๏ธ TypeGraphql 
    opened by vuki656 0
  • Nullable input type with defaultValue set

    Nullable input type with defaultValue set

    Given the following where we have a nullable field alongside with defaultValue, it should not force the field to be Type | null

    @Field(() => String, {
        defaultValue: "asdf",
        nullable: true
    })
    public description: string
    

    This will require writing the rule from scratch in https://bitbucket.org/rimacautomobili/eslint-plugin-rimac/src/master/

    ๐Ÿ› Bug Ruleset: โš›๏ธ TypeGraphql 
    opened by vuki656 0
Releases(v31.2.0)
Owner
Rimac Technology
Rimac Technology is a company focused on engineering, development, production, and supply of high-performance tech for automotive industry
Rimac Technology
An ESLint shareable configuration that used in our projects.

eslint-config An ESLint shareable configuration that used in our projects. Install npm install -D @rahagia/eslint-config or with yarn yarn add -D @rah

Organisasi Bahagia 5 Apr 18, 2022
An ESLint shareable configuration that used in our projects.

eslint-config An ESLint shareable configuration that used in our projects. Install npm install -D @clytage-pkg/eslint-config or with yarn yarn add -D

Clytage 6 Nov 17, 2022
This "To-do-list" app is a simple web application that displays a list of task and allows you to add and remove task from that list. it is built with the latest technology namely; JavaScript with webpack Configuration.

To-do-list "To-do-list" is a simple web application that displays a list of task and allows you to add and remove task from that list. Built With HTML

Aniekan udo 10 Nov 21, 2022
All-in-one solution for configuring ESLint in all of your projects

โœจ All-in-one solution for configuring ESLint in all of your projects โœจ โš ๏ธ May not work in your project. This is related to eslint module resolution pr

Eslint Kit 53 Nov 28, 2022
A boilerplate for ExpressJs projects configured with ESLint, Prettier & Airbnb Setup. The boilerplate utilises RESTful architecture and uses Mongodb.

ExpressJs-Boilerplate An ExpressJs boilerplate configured with ESLint, Prettier & Airbnb Setup. The boilerplate utilises RESTful architecture and uses

Hammas bin Farrukh 4 Mar 8, 2023
It's a repository to studies. Its idea is to learn about Nx and its plugins.

StudyingNx This project was generated using Nx. ?? Smart, Fast and Extensible Build System Adding capabilities to your workspace Nx supports many plug

Open-ish 4 May 13, 2022
Can see everything, beware of its omniscience, kneel before its greatness.

Can see everything, beware of its omniscience, kneel before its greatness. Summary Presentation Installation Removing Credits Presentation Main goal T

Duc Justin 3 Sep 30, 2022
This package includes some opinionated configuration for ESLint.

eslint-config-float This package includes some opinionated configuration for ESLint, used at Float and friends. Installation You can install and use t

Float 2 Jan 7, 2022
This package includes the sensible ESLint configuration used by our team

TypeScript + Prettier ESLint configuration for CasterlyApp team (and others)

Casterly 2 Jan 26, 2022
Shared eslint configuration for Strapi v4 plugins & applications.

This package is currently under development and should be consider ALPHA in terms of state. I/We are currently accepting contributions and/or dedicated contributors to help develop and maintain this package.

Strapi Community 6 Oct 28, 2022
TypeScript + Nextjs + Tailwind => TNT๐Ÿงจ (plus Prettier and ESLint configuration).

Bye bye next boilerplate, welcome to TNT! About This is TNT, Nextjs boilerplate powered by Typescript, Tailwind. This template also has customized ESL

Arvรฎn mostafaei 15 Aug 7, 2022
๐Ÿค Codely's ESLint + Prettier configuration

Opinionated linting configuration considering modern TypeScript best practices and providing consistency to your import statements. Valid for your JavaScript or TypeScript projects ??

CodelyTV 42 Dec 29, 2022
Its an app that uses a weather API with access to over 200,000 cities current weather conditons.

Weather App Its an app that uses a weather API with access to over 200,000 cities current weather conditons. Screenshots Links Live Site URL: live sit

Yusuf Lawal 5 Aug 17, 2022
A full stack application that uses an authentication system to allow FAA Inspectors, Airliners, and Aircraft Technicians to update progress on their work all while keeping a log of records on projects completed.

A full stack application that uses an authentication system to allow FAA Inspectors, Airliners, and Aircraft Technicians to update progress on their work all while keeping a log of records on projects completed.

BinaryBitBytes 3 Jun 13, 2022
Open Harvest is a technology designed farmers to publicly share the details of their crops/land to allow all farmers to stay informed on the best crops they can grow without risking a surplus crisis.

OpenHarvest OpenHarvest is a web application designed to balance farming production in India. Farmers in India are struggling with marketing their cro

Call for Codeยฎ with The Linux Foundation 11 Dec 8, 2022
โš™ With a little preparation, the typescript eslint generic rules for vodyani may be readily integrated into projects.

Vodyani eslint-config โš™ With a little preparation, the typescript eslint generic rules for vodyani may be readily integrated into projects. Installati

Vodyani 1 Sep 7, 2022
๐Ÿ’ป A simple Create Next App template to start your projects with Next.js, TypeScript, ESLint, Prettier and other tools.

โšก Next Typescript Template โšก A simple Create Next App template to start your projects with Next.js, TypeScript, ESLint, Prettier and other tools. Quic

Joรฃo Gabriel 13 Nov 23, 2022
This repo contains configurations for webpack, webhint, stylelint and eslint, it is a boiler-plate template and a starting point for coming projects.

Project Name Description the project. Built With Major languages Frameworks Technologies used Live Demo (if available) Experience a live Demo ?? Getti

Adel Guitoun 6 Oct 20, 2022
A template for your NestJS projects including Typescript, Eslint, Prettier, Jest and Docker.

NestJS Template Quickly start a new NestJS project A template for your NestJS projects including Typescript, Eslint, Prettier, Jest and Docker. โฉ Gett

Lorenzo Carneli 2 Oct 7, 2022