Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@losant/eslint-config-losant

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@losant/eslint-config-losant

Common eslint config for Losant

  • 1.7.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
380
decreased by-5.71%
Maintainers
0
Weekly downloads
 
Created
Source

@Losant / Eslint Config Losant

ESLint config for all Losant projects.

Installation

npm install --save-dev @losant/eslint-config-losant
yarn add --dev @losant/eslint-config-losant

Requirements

  • Node.js >=8.0.0

Configuration

Browser

{
  "eslintConfig": {
    "extends": "@losant/eslint-config-losant/env/browser"
  }
}

Node

{
  "eslintConfig": {
    "extends": "@losant/eslint-config-losant/env/node"
  }
}

Usage

You should add an npm script to the package.json of the project that specifies the eslint command. lint is the barebones setup you'll need to then be able to do yarn run lint. It's recommended that you add the other commands as well.

{
  "scripts": {
    "lint": "esw \"**/*.js\" src test",
    "lint:fix": "ews --fix \"**/*.js\" src test",
    "lint:watch": "esw --watch \"**/*.js\" src test",
    "lint:staged": "lint-staged"
  },
  "lint-staged": {
    "**/*.js": "esw"
  }
}

Documentation

The resulting combination of extended rules, overrides, and plugins are documented together with their specified options:

  • Rules common to both "browser" and "node"
  • Additional rules for "browser"
  • Additional rules for "node"

Pre-Push Hook with Husky

Pre-Push hooks can be easily configured with Husky to encourage linting across a project. Simply add a dev dependency for Husky, and add configuration.

npm install --save-dev husky
yarn add --dev husky
"husky": {
  "hooks": {
    "pre-commit": "lint-staged"
  }
}

Husky can be used for other Git Hooks as well. Check out their documentation for more details.

Optional Prettier Interop

If you others working in a shared repo have global local configurations for ESLint and/or Prettier, it may be desirable to configure ESlint & Prettier to operate without stepping on eachother's toes. This can be handled with some additional configuration.

npm install --save-dev eslint-config-prettier
yarn add --dev eslint-config-prettier

At the end of the project's list of ESLint configuration extends, add "prettier". This will tell ESLint not to worry about rules that Prettier deals with.

"extends": [
  "@losant/eslint-config-losant/env/browser",
  "plugin:import/react",
  "prettier"
],

Configure to run after lint with lint-staged.

"lint-staged": {
  "**/*.js": "esw --fix",
  "*.{js,css,md}": "prettier --write"
},

Keywords

FAQs

Package last updated on 19 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc