Code Monkey home page Code Monkey logo

eslint-config-ontario's Introduction

@ontario-digital-service/eslint-config-ontario

This package provides the shared ESLint configuration used by Ontario Frontend projects. It enforces a consistent code style for JavaScript projects to help keep code clean and readable.

Features

  • Print Width: Set to 80 characters to maintain readability across various devices and editors.
  • Tab Width: Uses 2 spaces for indentation to ensure code is clean and readable.
  • Semicolons: Requires semicolons at the end of statements for clarity.
  • Single Quotes: Enforces the use of single quotes for strings, except in Markdown files where double quotes are preferred.
  • Trailing Commas: Requires trailing commas in multi-line objects, arrays, etc., which makes version control diffs cleaner.
  • Bracket Spacing: Ensures spaces are present inside object literal braces for better readability.
  • Bracket Same Line: Places the closing angle bracket of elements on the same line as the last prop.
  • Overrides for Markdown: For .md files, double quotes are used instead of single quotes.

Installation

To use the @ontario-digital-service/eslint-config-ontario in your project, follow the steps for based on your package manager:

NPM

  1. First, you need to install ESLint if it's not already installed:

    npm install eslint --save-dev
  2. Next, install the @ontario-digital-service/eslint-config-ontario package:

    npm install @ontario-digital-service/eslint-config-ontario --save-dev

YARN

  1. First, you need to install ESLint if it's not already installed:

    yarn add eslint --dev
  2. Next, install the @ontario-digital-service/eslint-config-ontario package:

    yarn add @ontario-digital-service/eslint-config-ontario --dev

Usage

After installation, you'll need to set up your ESLint configuration file if you haven't already. Here's how:

  1. Create a file named .eslintrc.json in your project's root directory.

  2. Add the following content to .eslintrc.json to extend the @ontario-digital-service/eslint-config-ontario configuration:

    {
        "extends": "@ontario-digital-service/eslint-config-ontario"
    }

This line tells ESLint to use the @ontario-digital-service/eslint-config-ontario rules for your project.

Customizing

If you need to override any rules, you can do so within your project's .eslintrc file. For example:

{
  "extends": "@ontario-digital-service/eslint-config-ontario",
  "rules": {
    "no-unused-vars": "warn",
    "semi": ["error", "never"]
  }
}

This customization will change the handling of unused variables to a warning and remove the requirement for semicolons.

Contributing

We welcome contributions to improve the eslint-config-ontario package. Please feel free to submit a pull request or open an issue on our GitHub repository.

eslint-config-ontario's People

Contributors

mattstjean avatar

Stargazers

Andrew Wang avatar Matt St Jean avatar

Watchers

Andrew Wang avatar Matt St Jean 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.