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

@jsdevtools/eslint-config-modular

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsdevtools/eslint-config-modular

Modular ESLint configuration

  • 8.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-76.47%
Maintainers
2
Weekly downloads
 
Created
Source

Modular ESLint Configuration

Cross-Platform Compatibility Build Status

Coverage Status Dependencies

npm License

ESLint Modular is a shareable config for ESLint that's broken-up into different modules that can be mixed-and-matched to match the needs of your project.

Each module defines rules that are meant to be reasonable defaults and best practices, but you can easily extend or override any of the rules to suit your needs.

  • tslint-modular
    Modular TSLint configuration for TypeScript projects

Installation

Run the following npm command to install ESLint and ESLint Modular as dev-dependencies of your project:

npm install eslint @jsdevtools/eslint-config-modular --save-dev

Usage

Shareable configs are designed to work with the extends feature of .eslintrc files. You can learn more about Shareable Configs on the official ESLint website.

To use ESLint Modular in your project, create an .eslintrc.yml file with the following contents:

.eslintrc.yml

extends:
  # These modules would be good for a Node.js project written in ES5
  - "@jsdevtools/modular/best-practices"
  - "@jsdevtools/modular/style"
  - "@jsdevtools/modular/node"
  - "@jsdevtools/modular/es5"

rules:
  # You can override or extend any rules here

Modules

Modular ESLint Configuration includes the following modules. Mix-and-match them as applicable to your project.

@jsdevtools/modular/best-practices (source)

This module contains rules that prevent accidental bugs, insecure code, and bad coding practices. You can use this module directly, or use any/all of its sub-modules.

@jsdevtools/modular/best-practices/bugs (source)

The rules in this module prevent syntax that is likely to lead to accidental bugs or runtime errors. Examples include not reassigning native objects, and using === instead of == for comparisons. Most of the rules in this file will raise an error if violated, but some less-severe ones will only raise warnings.

@jsdevtools/modular/best-practices/security (source)

These rules help enforce security best-practices such as avoiding the eval() statement and requiring "use strict" directives.

@jsdevtools/modular/browser (source)

This module configures ESLint to recognize browser globals, such as window, document, navigator, etc. It also contains rules that are specific to projects that are intended to run in web browsers, such as avoiding the alert() statement and requiring the use strict directive within a function.

@jsdevtools/modular/browser/jsx (source)

This module configures ESLint to parse JSX syntax. It also contains JSX-specific rules, such as enforcing the use of double-quotes in JSX attributes.

@jsdevtools/modular/es5 (source)

This module configures ESLint to parse EcmaScript 5 code. It also disables ES6-specific rules, such as using let instead of var.

@jsdevtools/modular/es6 (source)

This module configures ESLint to parse EcmaScript 6 (and newer) code. It also contains ES6-specific rules, such as not assigning to constants, calling super() in constructors, and using let instead of var.

@jsdevtools/modular/modules/cjs (source)

This module configures ESLint to parse your JavaScript files with script semantics rather than ES6 module semantics, since CommonJS modules are not "true" JavaScript modules.

@jsdevtools/modular/modules/esm (source)

This module configures ESLint to parse your JavaScript files with ES6 module semantics rather than script semantics. It also disallows the use strict directive, since ES6 modules are always strict.

@jsdevtools/modular/node (source)

This module configures ESLint to recognize Node.js globals, such as process, __dirname, Buffer, etc. It also contains rules that are specific to Node.js projects, such as avoding new require() syntax and disallowing concatenation with __dirname.

@jsdevtools/modular/style (source)

This module contains code-styling and consistency rules. You can use this module directly, or use any/all of its sub-modules.

@jsdevtools/modular/style/conventions (source)

The rules in this module enforce an opinionated set of conventions, such as using double-quotes and semi-colons.

@jsdevtools/modular/style/naming (source)

These rules enforce JavaScript naming conventions, such as camel-case variables and capitialized classes.

@jsdevtools/modular/style/syntax (source)

These rules disallow outdated, nonstandard, and confusing syntax. Examples include labels, the comma operator, and nonstandard multiline strings.

@jsdevtools/modular/style/whitespace (source)

This module enforces opinionated whitespace rules, such as two-space indentation, Stroustrup style opening braces, and commas at the end of the line.

@jsdevtools/modular/test (source)

This module configures ESLint to recognize globals that are defined by common test frameworks, such as describe, it, beforeEach, etc. It also disables rules that tend to cause problems with certain test frameworks.

Note: We recommend that you create a separate .eslintrc.yml file in your test folder. That way, it can use different modules and rules than the rest of your codebase.

Big Thanks To

Thanks to these awesome companies for their support of Open Source developers ❤

Travis CI SauceLabs Coveralls

Keywords

FAQs

Package last updated on 09 Feb 2020

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