0.0.3 • Published 11 months ago

@gitdrops/eslint v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
11 months ago

@gitdrops/eslint

Simple ESLint preset

Installation

pnpm install @gitdrops/eslint eslint @antfu/eslint-config

Usage

Define and export the eslint config in eslint.config.js

import { defineEslintConfig } from "@gitdrops/eslint";

export default defineEslintConfig({
  rules: {
    "import/order": "off",
    "sort-imports": "off",
    "unused-imports/no-unused-vars": "off",
  },
});

Command Line

Add these package.json

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

VS Code Settings - prettier formatter

Add these settings to .vscode/settings.json

{
  "eslint.experimental.useFlatConfig": true,

  "editor.formatOnSave": true,

  "editor.rulers": [100],

  "editor.tabSize": 2,

  "editor.defaultFormatter": "esbenp.prettier-vscode",

  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },

  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

  "[jsonc]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },

  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "markdown",
    "json",
    "jsonc",
    "yaml"
  ],
  
}

VS Code Settings - stylistic formatter

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

  // Disable the default formatter, use eslint instead
  "prettier.enable": false,
  "editor.formatOnSave": false,

  // Auto fix
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },

  "[jsonc]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  }

  // Silent the stylistic rules in you IDE, but still auto fix them
  "eslint.rules.customizations": [
    { "rule": "style/*", "severity": "off" },
    { "rule": "format/*", "severity": "off" },
    { "rule": "*-indent", "severity": "off" },
    { "rule": "*-spacing", "severity": "off" },
    { "rule": "*-spaces", "severity": "off" },
    { "rule": "*-order", "severity": "off" },
    { "rule": "*-dangle", "severity": "off" },
    { "rule": "*-newline", "severity": "off" },
    { "rule": "*quotes", "severity": "off" },
    { "rule": "*semi", "severity": "off" }
  ],

  // Enable eslint for all supported languages
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "markdown",
    "json",
    "jsonc",
    "yaml",
    "toml"
  ],


  
  
}