Coder Social home page Coder Social logo

dsi-hug / eslint-config Goto Github PK

View Code? Open in Web Editor NEW
0.0 7.0 0.0 807 KB

✨ ESLint shareable configuration with great defaults

License: GNU General Public License v3.0

JavaScript 99.70% Shell 0.30%
eslint eslintconfig lint linter code style quality angular rxjs javascript

eslint-config's Introduction

@hug/eslint-config


hug-logo

ESLint shareable configuration with great defaults

npm version npm donwloads license GPLv3

build status PRs welcome


Installation

# Angular >= 12.x
$ npm install @hug/eslint-config --save-dev
$ yarn add [email protected] @hug/eslint-config --dev
# Angular >= 10.x <= 11.x
$ npm install @hug/[email protected] --save-dev
$ yarn add [email protected] @hug/[email protected] --dev

Requirements

As of now this configuration is intented to work with Angular projects only.

Projects running under Angular 10.x can safely ignore @angular-eslint warnings during installation.

  • an Angular >= 10.x project (see the migration guide for projects that are still using tslint)

Usage

  1. Create a tsconfig.eslint.json file at the root of your project
{
    "extends": "./tsconfig.json",
    "compilerOptions": {
        "types": [
            "node",
            "jasmine",
            //
            // In case you are using WebdriverIO
            //   "@wdio/globals/types"
            //
            // In case you are using Cypress
            //   "cypress"
            //
            // Any other types that are required by your tests
            //   ...
        ]
    },
    "include": [
        "src/**/*.ts",
        "e2e/**/*.ts"
    ]
}
  1. Create a .eslintrc.json file at the root of your project
{
    "root": true,
    "extends": [
        /**
         *  Possible values: 'recommended (strict) | moderate (less stricter)'
         */
        "@hug/eslint-config/recommended"
    ]
}
  1. Modify your existing angular.json
"architect": {
    "lint": {
        "builder": "@angular-eslint/builder:lint",
        "options": {
            "lintFilePatterns": [
                "**/*.js",
                "**/*.json",
                "**/*.ts",
                "**/*.html"
            ]
        }
    }
}
  1. Run ng lint

Rules

This configuration exports a recommended set of rules that enforces good practices.

They may or may not served you well as they are mainly designed to be used by the HUG organization's team.

The rules applies as follow:

Files Rules
**/*.ts es6, typescript, angular, rxjs, no-secrets
**/*.js es6, no-secrets
**/*.mjs es6, no-secrets
**/*.html angular-template
**/*.json no-secrets
e2e/**/*.ts es6, typescript, no-secrets, [cypress, chai-friendly - in case you are using Cypress]

Migrating from tslint

  1. Remove tslint and codelyzer from your dependencies

  2. Remove any tslint.json configuration files

  3. Add eslint as a dev dependency

  4. Have a look at our Angular project example and modify all your tsconfig files accordingly

Development

See the developer docs.

Contributing

> Want to Help?

Want to file a bug, contribute some code or improve documentation? Excellent!

But please read up first on the guidelines for contributing, and learn about submission process, coding rules and more.

> Code of Conduct

Please read and follow the Code of Conduct, and help us keep this project open and inclusive.

Credits

Copyright (C) 2021 HUG - Hôpitaux Universitaires Genève

love@hug

eslint-config's People

Contributors

badisi avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.