Skip to content

opencollective/eslint-config-opencollective

Repository files navigation

eslint-config-opencollective

npm version License

Shared ESLint configuration used across Open Collective projects.

Installation

First, add the ESLint scripts to your package.json:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "npm run lint -- --fix",
    "lint:quiet": "npm run lint -- --quiet"
  }
}

Then choose your project type:

Node.js Projects

  1. Install dependencies:
npm install --save-dev eslint @typescript-eslint/parser eslint-plugin-import eslint-plugin-n eslint-plugin-simple-import-sort eslint-config-opencollective
  1. Create .eslintrc.cjs in your project root:
import openCollectiveConfig from 'eslint-config-opencollective/eslint-node.config.cjs';

module.exports = {
  ...openCollectiveConfig,
  // Add your custom rules here
};

React Projects

  1. Install dependencies:
npm install --save-dev eslint @typescript-eslint/parser eslint-plugin-import eslint-plugin-n eslint-plugin-react eslint-plugin-simple-import-sort eslint-config-opencollective
  1. Create .eslintrc.cjs in your project root:
import openCollectiveConfig from 'eslint-config-opencollective/eslint-react.config.cjs';

module.exports = {
  ...openCollectiveConfig,
  // Add your custom rules here
};

Publishing

To publish a new version:

  1. Update the version in package.json:
npm version patch # for bug fixes
npm version minor # for new features
npm version major # for breaking changes
  1. Push the changes and the new tag:
git push --follow-tags
  1. Publish to npm:
npm publish