Giter VIP home page Giter VIP logo

eslint-config-adoyle-style's Introduction

eslint-config-adoyle-style

Node Version Npm Package Version License NodeJS Package Dependencies

A set of eslint shareable configurations for javascript code style, which follows ADoyle's code style.

The configurations for browser and server development. It supports ES6, and React/JSX.

Feature

  • Code style with my best practice
  • Configurations for different environments
  • Optional eslint-plugin configurations
  • Semver-checking with eslint-plugin configuration

Installation

# ATTENTION: Use `npm install -E` to install exact version.
npm install -DE eslint-config-adoyle-style
npm install -D eslint@7

# Only for browser
npm install -D eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react

# If your project use babel
npm install -D eslint-plugin-babel babel-eslint

# If your project use jest
npm install -D eslint-plugin-jest

Usage

Edit your .eslintrc file. Apply different code styles as below:

For NodeJS

It's default for ES6 syntax and ES6 global variables:

root: true
extends: adoyle-style/node

overrides:
  # This override is optional. You should install eslint-plugin-jest by yourself.
  - files:
      - '**/*.test.js'
      - '**/__mocks__/*.js'
    extends: adoyle-style/node/testing

"adoyle-style/node/testing" includes much appropriate plugins which installed by yourself.

For Browser

It's default for ES5 syntax:

root: true
extends: adoyle-style/browser

If you use ES6 syntax:

root: true
extends:
  - adoyle-style/browser
  - adoyle-style/browser/es6

Additional Plugins

Additional React/JSX support:

root: true
extends:
  - adoyle-style/browser
  - adoyle-style/browser/es6
  - adoyle-style/plugin/import
  - adoyle-style/plugin/jsx-a11y
  - adoyle-style/plugin/react

Additional Jest support:

root: true
extends:
  - adoyle-style/node
  - adoyle-style/plugin/jest

Additional Babel support:

root: true
extends:
  - adoyle-style/node
  - adoyle-style/plugin/babel

Additional import support:

root: true
extends:
  - adoyle-style/node
  - adoyle-style/plugin/import

Attention!

You should install each devDependency by yourself when using the adoyle-style/plugin/*. And each package's version should under the optionalDependencies. Such as eslint-plugin-jsx-a11y, eslint-plugin-import, eslint-plugin-react.

For Test

@TODO

Develop

Show differences

# install node modules
npm i
# update eslint related deps to latest
./tools/update_eslint_deps
# To show all differences between latest and current rules.
./tools/what_news

Then edit rules by yourself.

Query Rule

# To query rule description
./tools/find_rule $rule_name

# For example
./tools/find_rule default-param-last
#{
#    "type": "suggestion",
#    "docs": {
#        "description": "enforce default parameters to be last",
#        "category": "Best Practices",
#        "recommended": false,
#        "url": "https://eslint.org/docs/rules/default-param-last"
#    },
#    "messages": {
#        "shouldBeLast": "Default parameters should be last."
#    }
#}

./tools/find_rule import/imports-first
# {
#     "type": "suggestion",
#     "docs": {
#         "url": "https://github.com/benmosher/eslint-plugin-import/blob/7b25c1cb95ee18acc1531002fd343e1e6031f9ed/docs/rules/imports-first.md"
#     },
#     "fixable": "code",
#     "deprecated": true
# }

Versioning

The versioning follows the rules of SemVer 2.0.0.

For more information on SemVer, please visit http://semver.org/.

Copyright and License

Copyright 2020-2021 ADoyle ([email protected]). The project is licensed under the BSD 3-clause License.

See the LICENSE file for the specific language governing permissions and limitations under the License.

See the NOTICE file distributed with this work for additional information regarding copyright ownership.

eslint-config-adoyle-style's People

Contributors

adoyle-h avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.