1.0.3 • Published 3 years ago

eslint-config-bryan v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

eslint-config-bryan · CI Status npm GitHub license PRs Welcome Conventional Commits Commitizen friendly semantic-release

My approach to JavaScript linting

This is my ESLint Shareable Config which builds off of the Airbnb JavaScript Style Guide by adding additional ESLint configs and plugins that I find useful. In addition to the base config which is meant to lint only JavaScript, configs for TypeScript and React are also exported!

Installing / Getting started

Four standalone ESLint configurations are exported for your usage depending on the type of project.

eslint-config-bryan

  1. Installing the packages

If using npm 7+, run

npm install --save-dev eslint-config-bryan

which will also install its associated peer dependencies.

If not using npm 7+, run the above command and then install the packages listed by the command:

npm info eslint-config-bryan@latest peerDependencies

If using npm 5+, use this shortcut

npx install-peerdeps --dev eslint-config-brayn
  1. Extending the configuration

Once the config is installed, add "extends": "bryan" to your .eslintrc file.

eslint-config-bryan/typescript

This entry point enables the linting rules for TypeScript. To use, add "extends": ["bryan/typescript"] to your .eslintrc file.

This config requires knowledge of your TypeScript config.

In your ESLint config, set parserOptions.project to the path of your tsconfig.json. e.g.

{
   "extends": ["bryan/typescript"],
+  "parserOptions": {
+    "project": ["tsconfig.json"]
+  }
}

eslint-config-bryan/react

This entry point enables the linting rules for React. To use, add "extends": ["bryan/react"] to your .eslintrc file.

eslint-config-bryan/typescript-react

TODO.

Developing

Built With

  • ESLint
  • Typescript

Prerequisites

Node.js (v12+) and npm (v7+) are need to set up a dev environment for the project.

Setting up Dev

git clone https://github.com/bryan/eslint-config-bryan.git
cd eslint-config-bryan
# The postinstall script will run `npm link` and `npm link eslint-config-bryan`
npm install
# Compile the configs in `src` to generate `dist`
npm run build
# Link the package so that it can lint itself through `npm run lint`
npm link
npm link eslint-config-bryan

Building

Run npm run build:watch and npm run lint:watch to make development go smoother.

Note: If you run npm install <package name> of any form, npm link eslint-config-bryan will be broken and you'll need to run npm i again so that npm run lint doesn't break.

Deploying / Publishing

Make a commit that follows the conventional commit specification and then push to the main branch so that semantic-release can detect the changes and make an appropriate release.

Versioning

We follow SemVer for versioning.

Configuration

https://eslint.org/docs/user-guide/configuring/

Tests

No tests are present because I'm lazy. Also, other somewhat popular eslint configs (e.g. eslint-config-airbnb-typescript) don't have any tests which contributes to my lack of motivation to write tests.

Style guide

This project uses itself it check its style (an extension of the Airbnb JavaScript Style Guide).

To check it, run

npm run lint

Contributing

See CONTRIBUTING.md.

Code of Conduct

This project's Code of Conduct (see CODE_OF_CONDUCT.md) is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html.

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq.

Licensing

MIT License

Copyright (c) 2021 Bryan Hoang

See LICENSE.