New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

eslint-presets

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-presets

ESLint presets

latest
npmnpm
Version
2.3.3
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source
ESLint

version downloads

Shareable ESLint config presets.

Usage

  • Install package:
pnpm add --save-dev eslint eslint-presets
  • Create ESLint configuration file eslint.config.js:
import { defineFlatConfig, presetBasic } from 'eslint-presets'

export default defineFlatConfig([
  presetBasic({ enableTs: true }),
  // {
  //   rules: {...}
  // }
])

If your project does not specify "type":"module" in its package.json file, then eslint.config.js must be in CommonJS format, such as:

module.exports = (async () => {
  const { defineFlatConfig, presetBasic } = await import('eslint-presets')
  return defineFlatConfig([
    presetBasic({ enableTs: true }),
    // {
    //   rules: {...}
    // }
  ])
})()
  • Add script for package.json:
{
  "scripts": {
    "lint": "eslint .",
  }
}

VS Code support

Install VS Code ESLint extension

Add the following settings to your project setting .vscode/settings.json:

{
  // Auto fix
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true,
    "source.organizeImports": false
  },

  // Enable the flat config support
  "eslint.experimental.useFlatConfig": true,

  // Enable eslint for supported languages
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "astro",
    "vue"
  ]
}

Please support this project by simply putting a star.

And, enjoy :)

Keywords

eslint-config

FAQs

Package last updated on 27 Oct 2023

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