Skip to content

InamTaj/jslint-configs

Repository files navigation

jslint-configs

npm GitHub issues node npm peer dependency version npm GitHub

THE best lint configurations for JS, React, Node, Jest and even React Native!

Stop relying on humans to write consistent and good quality JavaScript. Use jslint-configs to ensure your code is clean from common mistakes of JavaScript/React/Node and while doing that, give your developer-productivity an unfair boost!

⭐️ Features

jslint-configs support linting for the following technologies:

  • JavaScript and ES6
  • Node.js
  • React.js (with latest React Hooks)
  • React Native

💡 For quickly increasing developer's knowledge it also has respective hyperlink for each lint rule as follows:

'arrow-parens': [2,   // https://eslint.org/docs/rules/arrow-parens
  'as-needed',
],

⭐️ Bonus Features ⭐

  • Well documented
  • Extremely small bundle size: 9~11 KB

💿 Installation

Please ensure that eslint is already installed in your project

  • For Yarn: yarn add --dev jslint-configs
  • For NPM: npm install --save-dev jslint-configs

📖 About Lint Setup

The way this lint configuration is setup as follows:

  • Base Configuration (Parent configuration - includes all standard JS linting rules)
  • React Configuration (Inherits from Base Config - adds up all standard React.js and JSX linting rules)
  • React Native Configuration (Inherits from React Config - adds up RN specific rules on top of React rules)
  • Node Configuration (Inherits from Base Config - adds up all standard Node.js linting rules)

Let the picture speak a thousand words!

ESLint Configuration Diagram

🔧 Usage

  • Install ESLint in your project (yarn add --dev eslint)
  • Create .eslintrc.js at the root of your project

Vanilla JavaScript

If you want to lint only vanilla JavaScript, extend your project's .eslintrc.js file from config-base as follows:

module.exports = {
  extends: "./node_modules/jslint-configs/index.js",
};

React.JS Linting

If you want to lint JavaScript + React.JS code, extend your project's .eslintrc.js file from config-react as follows:

module.exports = {
  extends: "./node_modules/jslint-configs/config-react.js",
};

React Native Linting

If you want to lint JavaScript + React Native code, extend your project's .eslintrc.js file from config-react as follows:

module.exports = {
  extends: "./node_modules/jslint-configs/config-react-native.js",
};

Node.JS Linting

If you want to lint JavaScript + Node.JS, extend your project's .eslintrc.js file from config-node as follows:

module.exports = {
  extends: "./node_modules/jslint-configs/config-node.js",
};

❤️ Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.