Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-config-amity

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-amity

Eslint configuration for Amity

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

eslint-config-amity

ESLint config for Amity orgnization.

Install

yarn add --dev eslint-config-amity eslint prettier
# npm i --dev eslint-config-amity eslint prettier

Usage

// .eslintrc.js

// for javascript project
{
  "extends": "amity"
}

// for typescript project
{
  "extends": "amity/typescript"
}

// for react project
{
  "extends": "amity/react"
}

Best practice:

Add .prettierrc file at the root of your project

{
  "tabWidth": 2,
  "useTabs": false,
  "singleQuote": true,
  "trailingComma": "all",
  "quoteProps": "as-needed",
  "semi": true,
  "bracketSpacing": true,
  "arrowParens": "avoid",
  "printWidth": 120
}

For VS code developers, add .vscode/settings.json file at the root of your project

// See VS Code settings in https: //code.visualstudio.com/docs/getstarted/settings#_default-settings
{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "search.exclude": {
    "**/node_modules": true,
    "**/dist": true
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true
  },
  "typescript.tsdk": "node_modules/typescript/lib",
  "typescript.format.semicolons": "remove"
}

Add package.json scripts

"scripts": {
  "lint": "eslint . --ext .js,.ts",
  "lint:fix": "eslint . --ext .js,.ts --fix",
  "prettier": "prettier --write '{src,test}/**/*.{ts,json,md}'"
}

Setup project for auto-linting on commit hooks:

yarn add --dev husky lint-staged
# npm i --dev husky lint-staged

In package.json:

"husky": {
  "hooks": {
    "post-commit": "git update-index --again",
    "pre-commit": "lint-staged",
    "pre-push": "yarn test",
    "commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS"
  }
},
"lint-staged": {
  "*.{ts,js,jsx}": [
    "yarn prettier",
    "yarn lint"
  ],
  "*.{json,md}": [
    "yarn prettier"
  ]
}

Use commitlint

yarn add --dev @commitlint/cli @commitlint/config-angular
# npm i --dev @commitlint/cli @commitlint/config-angular

add .commitlintrc.json at the root:

{
  "extends": ["@commitlint/config-angular"],
  "rules": {
    "subject-case": [2, "always", ["sentence-case", "start-case", "pascal-case", "upper-case", "lower-case"]],
    "type-enum": [2, "always", ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "sample"]]
  }
}

In package.json:

"husky": {
  "hooks": {
    ...
    "commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS"
  }
}

Keywords

FAQs

Package last updated on 23 Feb 2021

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