npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-config-lionel-lints

v10.0.3

Published

Lionel Lints's shareable ESLint configuration

Downloads

2

Readme

eslint-config-lionel-lints

License

Lionel Lints's fork of Ryan Sobol's shareable ESLint configuration. This fork is being cut to experiment with different rules and styleguides while maintaining the overall linting philosophy set out by the original repo.

Philosophy

A major aspect of the ESLint philosophy is that it doesn't promote any particular coding style. While there are many different styles of writing JavaScript, the ESLint rules in this shareable configuration adhere the following philosophy.

  • Declare all available rules
  • Support ECMAScript 5 and above
  • Be compatible with alternative parsers
  • Break the build when code fails any rule
  • Equip developers with powerful semantics
  • Teach developers how to write maintainable code
  • Allow any rule to be overridden on a per project basis

Dependencies

| Dependency | Type | Version | |------------------------------|----------|----------------------| | eslint | Peer | ^3.10.2 | | eslint-plugin-react | Required | ^6.7.1 | | node | Engine | ^4.2.0 || >= 6.0.0 |

Global usage

Install the package globally.

npm install -g eslint eslint-config-lionel-lints

Change into your project's directory.

cd path/to/project

Create a .eslintrc.js configuration file.

touch .eslintrc.js

Add language configuration and environment configuration to the .eslintrc.js file.

module.exports = {
  extends: [
    'lionel-lints/browser',
    'lionel-lints/es6'
  ]
};

Run eslint globally and fix any linting errors.

eslint .

Local usage

Change into your project's directory.

cd path/to/project

If you haven't already, create a package.json file.

npm init

Install the package locally and add it to the package.json file as a development dependency.

npm install -D eslint eslint-config-lionel-lints

Create a .eslintrc.js configuration file.

touch .eslintrc.js

Add language configuration and environmnent configuration to the .eslintrc.js file.

module.exports = {
  extends: [
    'lionel-lints/browser',
    'lionel-lints/es6'
  ]
};

Run eslint locally and fix any linting errors.

./node_modules/.bin/eslint .

Additionally, add a script to the package.json file.

{
  "script": {
    "lint": "eslint"
  }
}

Then run the npm script and fix any linting errors.

npm run lint .

Language configuration

A project is linted by one of the following language configurations.

| Language | Module | |--------------|----------------------| | ECMAScript 5 | lionel-lints/es5 | | ECMAScript 6 | lionel-lints/es6 | | ECMAScript 7 | lionel-lints/es7 | | ECMAScript 8 | lionel-lints/es8 |

Add the following code to the .eslintrc.js file of an ECMAScript 6 project.

module.exports = {
  extends: 'lionel-lints/es6'
};

Or add the following code to the .eslintrc.js file of an ECMAScript 7 project.

module.exports = {
  extends: 'lionel-lints/es7'
};

Overriding rules

Customize any rule by overriding it in the .eslintrc.js file.

module.exports = {
  extends: 'lionel-lints/es6',

  rules: {
    'brace-style': [2, '1tbs', { allowSingleLine: true }],
  }
};

Environment configuration

Additionally, a project is linted by any of the following environment configurations.

| Environment | Module | |-------------|----------------------------| | browser | lionel-lints/browser | | Express | lionel-lints/express | | jQuery | lionel-lints/jquery | | Materialize | lionel-lints/materialize | | Mocha | lionel-lints/mocha | | Node.js | lionel-lints/node | | React | lionel-lints/react |

Add the following code to the .eslintrc.js file of an ECMAScript 6 project that's running in a browser.

module.exports = {
  extends: [
    'lionel-lints/browser',
    'lionel-lints/es6'
  ]
};

Add the following code to the .eslintrc.js file of an ECMAScript 6 project that's running in a browser and using jQuery.

module.exports = {
  extends: [
    'lionel-lints/browser',
    'lionel-lints/es6',
    'lionel-lints/jquery'
  ]
};

Add the following code to the .eslintrc.js file of an ECMAScript 6 project that's running in Node.js.

module.exports = {
  extends: [
    'lionel-lints/es6',
    'lionel-lints/node'
  ]
};

Add the following code to the .eslintrc.js file of an ECMAScript 6 project that's running in both a browser and Node.js as well as using React.

module.exports = {
  extends: [
    'lionel-lints/browser',
    'lionel-lints/es6',
    'lionel-lints/node',
    'lionel-lints/react'
  ]
};

NOTE: To include .jsx files in the linting, use the eslint . --ext .js,.jsx command.

Parsers options

Parser options, like support for ECMAScript 6 modules, can be specified in the .eslintrc.js file.

module.exports = {
  extends: [
    'lionel-lints/browser',
    'lionel-lints/es6',
    'lionel-lints/node',
    'lionel-lints/react'
  ],

  parserOptions: {
    sourceType: 'module'
  }
};

Alternative parsers

The default parser is Espree but alternative parsers, like babel-eslint, can be specified in the .eslintrc.js file.

module.exports = {
  extends: [
    'lionel-lints/browser',
    'lionel-lints/es6',
    'lionel-lints/node',
    'lionel-lints/react'
  ],

  parser: 'babel-eslint'
};

ESLint environments

Additional ESLint environments, like worker, can also be specified in the .eslintrc.js file.

module.exports = {
  env: {
    worker: true
  },

  extends: [
    'lionel-lints/browser',
    'lionel-lints/es6',
    'lionel-lints/node',
    'lionel-lints/react'
  ]
};

Contributing

If you want to customize any of the rules for your own project, see the section on overriding rules to learn how.

Pull requests are very much welcome for the following.

Credits

Thanks to the Shopify team for publishing eslint-config-shopify under a permissive license.

Also, thanks to my colleagues and students at Galvanize for helping me with testing.

A final thanks to Ryan for setting up an awesome linting walkthrough that I can build on.