|
1 |
| -# Nuxt ESLint packages |
| 1 | + |
2 | 2 |
|
3 |
| -## Nuxt 3: `@nuxt/eslint-config` |
| 3 | +# Nuxt ESLint |
4 | 4 |
|
5 |
| -[![npm version][npm-version-src]][npm-version-href] |
6 |
| -[![npm downloads][npm-downloads-src]][npm-downloads-href] |
7 |
| -<!--[![Github Actions][github-actions-src]][github-actions-href] |
8 |
| -[![Codecov][codecov-src]][codecov-href] |
9 |
| -[![Bundlephobia][bundlephobia-src]][bundlephobia-href] |
10 |
| -[![LGTM][lgtm-src]][lgtm-href]--> |
| 5 | +<p> |
| 6 | + <a href="./LICENSE"> |
| 7 | + <img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"> |
| 8 | + </a> |
| 9 | +</p> |
11 | 10 |
|
12 |
| -> Non-opinionated [ESlint](https://eslint.org/) configuration for Nuxt 3 apps. |
| 11 | +Collection of ESLint-related packages for Nuxt, |
| 12 | +provides project-aware, easy-to-use, extensible and future-proof integrations. |
13 | 13 |
|
14 |
| -### Features |
| 14 | +Refer to the [documentation](https://eslint.nuxt.com) for more details. |
15 | 15 |
|
16 |
| -- Works out-of-the-box with no additional configuration. |
17 |
| -- Nuxt-specific rules for pages, components and more. |
18 |
| -- ... under active development |
| 16 | +## Packages |
19 | 17 |
|
20 |
| -### Installation |
21 |
| - |
22 |
| -1. Install this package and `eslint` in your `devDependencies`. |
23 |
| - |
24 |
| -```bash |
25 |
| -npm i -D @nuxt/eslint-config eslint |
26 |
| -yarn add -D @nuxt/eslint-config eslint |
27 |
| -pnpm add -D @nuxt/eslint-config eslint |
28 |
| -``` |
29 |
| - |
30 |
| -2. Extend the default Nuxt config by creating an `.eslintrc.cjs`: |
31 |
| - |
32 |
| -```js |
33 |
| -module.exports = { |
34 |
| - root: true, |
35 |
| - extends: ["@nuxt/eslint-config"], |
36 |
| -}; |
37 |
| -``` |
38 |
| - |
39 |
| -You might also want to add a script entry to your `package.json: |
40 |
| - |
41 |
| -```json |
42 |
| -{ |
43 |
| - "scripts": { |
44 |
| - "lint": "eslint ." |
45 |
| - } |
46 |
| -} |
47 |
| -``` |
48 |
| - |
49 |
| -## Nuxt 2: `@nuxtjs/eslint-config` and `@nuxtjs/eslint-config-typescript` |
50 |
| - |
51 |
| -[](https://github.com/nuxt/eslint-config/actions?query=workflow%3Aci) |
52 |
| -[](https://npmjs.com/package/@nuxtjs/eslint-config) |
53 |
| -[](https://npmjs.com/package/@nuxtjs/eslint-config) |
54 |
| - |
55 |
| -> Opinionated [ESlint](https://eslint.org/) configuration used internally by Nuxt projects. |
56 |
| -
|
57 |
| -### Usage |
58 |
| - |
59 |
| -Do you want to add the config to your own projects? There you go: |
60 |
| - |
61 |
| -1. Add this package to your devDependencies |
62 |
| - |
63 |
| -```bash |
64 |
| -$ npm i -D @nuxtjs/eslint-config |
65 |
| -# or |
66 |
| -$ yarn add -D @nuxtjs/eslint-config |
67 |
| -``` |
68 |
| - |
69 |
| -2. Install `eslint` if not already present locally or globally |
70 |
| - |
71 |
| -```bash |
72 |
| -$ npm i -D eslint |
73 |
| -# or |
74 |
| -$ yarn add -D eslint |
75 |
| -``` |
76 |
| - |
77 |
| -3. Create a `.eslintrc` file |
78 |
| - |
79 |
| -4. Extend our config (you can use just the scope name as ESLint will assume the `eslint-config` prefix): |
80 |
| - |
81 |
| -```json |
82 |
| -{ |
83 |
| - "extends": ["@nuxtjs/eslint-config"] |
84 |
| -} |
85 |
| -``` |
86 |
| - |
87 |
| -### Full example |
88 |
| - |
89 |
| -A full example `.eslintrc` for a project with babel support: |
90 |
| - |
91 |
| -> Dont forget to `npm i -D @babel/eslint-parser` or `yarn add -D @babel/eslint-parser` |
92 |
| -
|
93 |
| -```json |
94 |
| -{ |
95 |
| - "root": true, |
96 |
| - "parser": "@babel/eslint-parser", |
97 |
| - "parserOptions": { |
98 |
| - "sourceType": "module" |
99 |
| - }, |
100 |
| - "extends": ["@nuxt/eslint-config"], |
101 |
| -} |
102 |
| -``` |
103 |
| - |
104 |
| -### TypeScript |
105 |
| - |
106 |
| -If you're using TypeScript, follow [Usage](#usage) section by replacing `@nuxtjs/eslint-config` by `@nuxtjs/eslint-config-typescript`. |
107 |
| - |
108 |
| -And in your `.eslintrc` all you need is : |
109 |
| - |
110 |
| -```json |
111 |
| -{ |
112 |
| - "extends": ["@nuxtjs/eslint-config-typescript"] |
113 |
| -} |
114 |
| -``` |
115 |
| - |
116 |
| -You can then edit/override same rules as you could with `@nuxtjs/eslint-config` but also TypeScript rules. |
117 |
| -You can find the list of supported TypeScript rules [here](https://typescript-eslint.io/rules/#supported-rules) and you can read more about Nuxt's TypeScript support [in the docs](https://nuxt.com/docs/guide/concepts/typescript). |
| 18 | +- [@nuxt/eslint](./packages/module) - Nuxt module generating project-aware ESLint config |
| 19 | +- [@nuxt/eslint-config](./packages/eslint-config) - Static ESLint Config |
| 20 | +- [@nuxt/eslint-plugin](./packages/eslint-plugin) - ESLint Plugin |
118 | 21 |
|
119 | 22 | ## License
|
120 | 23 |
|
121 |
| -Made with ❤️ |
122 |
| - |
123 |
| -Published under [MIT License](./LICENCE). |
124 |
| - |
125 |
| -<!-- Badges --> |
126 |
| - |
127 |
| -[npm-version-src]: https://img.shields.io/npm/v/@nuxt/eslint-config?style=flat-square |
128 |
| -[npm-version-href]: https://npmjs.com/package/@nuxt/eslint-config |
129 |
| -[npm-downloads-src]: https://img.shields.io/npm/dm/@nuxt/eslint-config?style=flat-square |
130 |
| -[npm-downloads-href]: https://npmjs.com/package/@nuxt/eslint-config |
131 |
| -[github-actions-src]: https://img.shields.io/github/workflow/status/nuxt/eslint-config/ci/main?style=flat-square |
132 |
| -[github-actions-href]: https://github.com/nuxt/eslint-config/actions?query=workflow%3Aci |
133 |
| -[codecov-src]: https://img.shields.io/codecov/c/gh/nuxt/eslint-config/main?style=flat-square |
134 |
| -[codecov-href]: https://codecov.io/gh/nuxt/eslint-config |
135 |
| -[lgtm-src]: https://img.shields.io/lgtm/grade/javascript/github/nuxt/eslint-config?style=flat-square |
136 |
| -[lgtm-href]: https://lgtm.com/projects/g/nuxt/eslint-config |
137 |
| -[bundlephobia-src]: https://img.shields.io/bundlephobia/minzip/@nuxt/eslint-config?style=flat-square |
138 |
| -[bundlephobia-href]: https://bundlephobia.com/package/@nuxt/eslint-config |
| 24 | +[MIT License](./LICENSE) |
0 commit comments