4.6.1 • Published 5 months ago

@tiagoporto/eslint-config v4.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@tiagoporto/eslint-config

Shareable Config for ESlint.

Installation

npm install --save-dev eslint globals @tiagoporto/eslint-config

Usage

Browser

// eslint.config.mjs
import globals from 'globals'

/** @type {import('eslint').Linter.Config[]} */
export default [
  {
    languageOptions: { globals: globals.browser }
  }
]

Node

// eslint.config.mjs
import globals from 'globals'

/** @type {import('eslint').Linter.Config[]} */
export default [{ languageOptions: { globals: globals.node } }]

configs

base

Linted files

  • HTML - html and code into script tag
  • YAML - yml, and yaml
  • Json - json, jsonc and json5
  • Markdown - md, markdown, mdx and code blocks
  • Javascript - js,mjs and cjs
  • Typescript - ts,mts and cts
// eslint.config.mjs
import tpConfig from '@tiagoporto/eslint-config'

/** @type {import('eslint').Linter.Config[]} */
export default [...tpConfig.configs.base]

react

Linted files

All from base config plus JavaScript XML - jsx and tsx

// eslint.config.mjs
import tpConfig from '@tiagoporto/eslint-config'

/** @type {import('eslint').Linter.Config[]} */
export default [...tpConfig.configs.react]

In package.json add the following scripts:

{
  "scripts": {
    "lint": "eslint --max-warnings 0",
    "lint:fix": "npm run lint -- --write"
  }
}

Lint-staged

Check staged files

// .lintstagedrc.mjs
export default {
  '*.{md,markdown,mdx}': [
    // remark,
    'eslint --max-warnings 0 --no-warn-ignored'
  ],
  '*.{html,yml,json,jsonc,json5}': 'eslint --max-warnings 0 --no-warn-ignored',
  '*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}': [
    'eslint --max-warnings 0 --no-warn-ignored'
    // unit test
  ]
}

Editor

For VSCode is recommended the following extensions:

// .vscode/settings.json
{
  "editor.codeActionsOnSave": {
    "source.fixAll": "explicit"
  },
  "editor.formatOnSave": true,
  "eslint.validate": ["yaml", "github-actions-workflow"]
}
4.5.0

5 months ago

4.4.0

5 months ago

4.6.1

5 months ago

4.6.0

5 months ago

2.11.0

6 months ago

3.0.0-alpha.1

6 months ago

2.10.0

6 months ago

3.0.0-alpha.3

6 months ago

3.0.0-alpha.2

6 months ago

3.0.0-alpha.4

6 months ago

4.0.0-alpha.3

5 months ago

4.0.0-alpha.1

5 months ago

4.0.0-alpha.2

5 months ago

3.2.0-alpha.1

5 months ago

3.1.1

5 months ago

3.1.0

5 months ago

3.0.0

6 months ago

4.1.0

5 months ago

4.0.0

5 months ago

4.3.0

5 months ago

4.2.0

5 months ago

2.9.1

6 months ago

2.7.0

6 months ago

2.9.0

6 months ago

2.8.0

6 months ago

2.5.0

6 months ago

2.6.0

6 months ago

2.4.1

6 months ago

2.4.0

6 months ago

2.3.0

6 months ago

2.2.0

6 months ago

2.1.0

6 months ago

2.0.0

6 months ago

2.0.0-alpha.1

6 months ago

1.0.0

6 months ago

1.0.0-alpha.2

6 months ago

1.0.0-alpha.1

6 months ago