eslint-config-mytools
v1.0.1
Published
[](https://www.npmjs.com/package/eslint-config-mytools) [](https://www.npmjs.com/package/eslint-config-mytools) [![
Maintainers
Readme
Introduction
eslint-config-mytools helps you configure eslint and prettier in your project according to your team's needs.
Installation
pnpm add -D eslint eslint-config-mytoolsIf you also need prettier, you need to install it:
pnpm add -D prettier prettier-plugin-astroIf your project is using Astro, you will also need to install the prettier library for Astro:
pnpm add -D prettierConfigure eslint for Javascript projects
You have to create an eslint.config.mjs file in your project and import the js config:
import { defineConfig } from 'eslint/config'
import { base } from 'eslint-config-mytools'
export default defineConfig([
...base,
])Configure eslint for Typescript projects
You have to create an eslint.config.mjs file in your project and import the js config:
import { defineConfig } from 'eslint/config'
import { base, typescript } from 'eslint-config-mytools'
export default defineConfig([
...base,
...typescript,
])Configure eslint for React projects with Typescript or Javascript
You have to create an eslint.config.mjs file in your project and import the js config:
import { defineConfig } from 'eslint/config'
import { base, typescript, react } from 'eslint-config-mytools'
export default defineConfig([
...base,
...typescript,
...react,
])Configure eslint for Astro projects
You have to create an eslint.config.mjs file in your project and import the js config:
import { defineConfig } from 'eslint/config'
import { astro, base, typescript } from 'eslint-config-mytools'
export default defineConfig([
...base,
...typescript,
...astro,
])If you have React, add the config as well:
import { defineConfig } from 'eslint/config'
import { astro, base, typescript, react } from 'eslint-config-mytools'
export default defineConfig([
...base,
...typescript,
...astro,
...react,
])Configure Prettier for any project
You have to create an eslint.config.mjs file in your project and import the js config:
import { defineConfig } from 'eslint/config'
import { prettier } from 'eslint-config-mytools'
export default defineConfig([
...prettier,
])If you want .astro, .json, and .md files to work with prettier, a prettier.config.mjs file is required:
/**
* @see https://prettier.io/docs/configuration
* @type {import("prettier").Config}
*/
export default {
plugins: ['prettier-plugin-astro'],
singleQuote: true,
printWidth: 120,
semi: false,
trailingComma: 'all',
}And add the following script to your package.json file:
{
"format": "prettier --write **/*{.astro,.json,.md}"
}The prettier configuration imported into eslint will only affect files: **/*.{js,mjs,cjs,jsx,ts,jsx,tsx}
