New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wang1212/eslint-config

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wang1212/eslint-config

Community-recommended best practices for [ESLint](https://eslint.org/) rule configuration.(Use with [Prettier](https://prettier.io/))

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ESLint Config

LICENSE NPM VERSION DOWNLOAD LAST COMMIT GITHUB PACKAGE CI Commitizen friendly Codacy Badge

English | 简体中文

🔧 This package provides community-recommended ESLint rules configuration as an extensible shared configuration. (Use with Prettier)

Support ESLint V8, Node.js requires version >=16.

Usage

npm install --save-dev @wang1212/eslint-config
  1. Install peerDependencies:

    npm install --save-dev eslint
    npm install --save-dev --save-exact prettier
    
  2. Create a .prettierrc.yml file in the project root directory and configure the following:

    # see docs: https://prettier.io/docs/en/configuration.html
    
    # prettier config
    printWidth: 80
    tabWidth: 2
    useTabs: false
    singleQuote: true
    semi: true
    endOfLine: 'auto'
    

    This is just a recommended configuration and can be adjusted to your liking.

  3. Then you need to add @wang1212/eslint-config in your .eslintrc.json:

    {
    + "extends": ["@wang1212/eslint-config"]
    }
    

    The rule configuration of ESLint can be configured and covered according to your own requirements, please refer to the official documentation.

Configuration Details

@wang1212/eslint-config

This configuration is for basic JavaScript, based on the Airbnb JavaScript Style Guide, SonarJS, JSDoc, and check API compatibility with Browserslist. (See Source)

@wang1212/eslint-config/typescript

This configuration is for basic TypeScript, based on the Airbnb JavaScript Style Guide, SonarJS, TSDoc, and check API compatibility with Browserslist. (See Source)

This config also has an alias @wang1212/eslint-config/ts.

Using this configuration also requires some extra work.

  1. Install additional peerDependencies:

    npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
    

    Note: according to the official maintenance policy, the above dependencies should always be installed with the same version number.

  2. Then you need to add @wang1212/eslint-config/typescript in your .eslintrc.json:

    {
    - "extends": ["@wang1212/eslint-config"],
    + "extends": ["@wang1212/eslint-config/typescript"],
    + "parser": "@typescript-eslint/parser",
    + "parserOptions": {
    +   "project": './tsconfig.json'
    + },
    }
    

@wang1212/eslint-config/react

This configuration is for react.js applications written in JavaScript, based on the Airbnb JavaScript Style Guide, Hooks, SonarJS, JSDoc, and check API compatibility with Browserslist. (See Source)

Using this configuration also requires some extra work.

  • You need to add @wang1212/eslint-config/react in your .eslintrc.json:

    {
    - "extends": ["@wang1212/eslint-config"],
    + "extends": ["@wang1212/eslint-config/react"],
    }
    

@wang1212/eslint-config/react-typescript

This configuration is for react.js applications written in TypeScript, based on the Airbnb JavaScript Style Guide, Hooks, SonarJS, TSDoc, and check API compatibility with Browserslist. (See Source)

This config also has an alias @wang1212/eslint-config/react-ts.

Using this configuration also requires some extra work.

  1. Install additional peerDependencies:

    npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
    

    Note: according to the official maintenance policy, the above dependencies should always be installed with the same version number.

  2. Then you need to add @wang1212/eslint-config/react-typescript in your .eslintrc.json:

    {
    - "extends": ["@wang1212/eslint-config"],
    + "extends": ["@wang1212/eslint-config/react-typescript"],
    + "parser": "@typescript-eslint/parser",
    + "parserOptions": {
    +   "project": './tsconfig.json'
    + },
    }
    

@wang1212/eslint-config/node

This configuration is for Node.js programs written in JavaScript, based on the Airbnb JavaScript Style Guide, SonarJS, JSDoc. (See Source)

Using this configuration also requires some extra work.

  • You need to add @wang1212/eslint-config/node in your .eslintrc.json:

    {
    - "extends": ["@wang1212/eslint-config"],
    + "extends": ["@wang1212/eslint-config/node"],
    }
    

Development Guidelines

Git Commit Message Format

Adopt community commit format best practices:

# Before
git commit

# Now
npm run commit

This constraint relies on tools commitizen and commitlint provided by the community.

npm publish

The version management of this module adopts the specifications recommended by the community Semantic Versioning. Follow version changes and maintain a CHANGELOG.md(Learn why).

# Update version and generate changelog before publishing to npm repository
npm run release
# Or, preview
npm run release -- --dry-run

# Then publish to npm, if yes is not selected when auto-publishing to npm
npm publish # npm publish --access public

These jobs are done with the help of release-it tool provided by the community.

License

MIT.

Keywords

FAQs

Package last updated on 13 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc