Skip to content

Commit ec14212

Browse files
antfuricardogobbosouzaModyQyW
authored
feat: flat config, eslint plugin, and nuxt module (#332)
Co-authored-by: ricardogobbosouza <[email protected]> Co-authored-by: ModyQyW <[email protected]>
1 parent a17d0e1 commit ec14212

File tree

96 files changed

+21638
-881
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+21638
-881
lines changed

.github/assets/social-card.png

464 KB
Loading

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
with:
1919
node-version: 16
2020
- run: pnpm install
21+
- run: pnpm build
2122
- run: pnpm lint
2223
- run: pnpm vitest run
2324
- uses: codecov/codecov-action@v3

.github/workflows/release.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 18.18.2
22+
23+
- run: npx changelogithub
24+
env:
25+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
# Dependencies
21
node_modules
3-
package-lock.json
4-
5-
# Intellij idea
62
*.iml
73
.idea
8-
94
*.log
10-
11-
# Yarn
5+
.nuxt
6+
.output
127
**/.yarn/cache
138
**/.yarn/*state*
9+
dist
10+
.eslintcache

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
ignore-workspace-root-check=true

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.experimental.useFlatConfig": true
3+
}

CHANGELOG.md

-57
This file was deleted.

README.md

+15-129
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,24 @@
1-
# Nuxt ESLint packages
1+
![@nuxt/eslint](./.github/assets/social-card.png)
22

3-
## Nuxt 3: `@nuxt/eslint-config`
3+
# Nuxt ESLint
44

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>
1110

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.
1313

14-
### Features
14+
Refer to the [documentation](https://eslint.nuxt.com) for more details.
1515

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
1917

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-
[![GitHub Actions](https://flat.badgen.net/github/checks/nuxt/eslint-config/main)](https://github.com/nuxt/eslint-config/actions?query=workflow%3Aci)
52-
[![npm](https://flat.badgen.net/npm/dm/@nuxtjs/eslint-config)](https://npmjs.com/package/@nuxtjs/eslint-config)
53-
[![npm (scoped with tag)](https://flat.badgen.net/npm/v/@nuxtjs/eslint-config)](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
11821

11922
## License
12023

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)

docs/.env.example

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# To use Nuxt UI Pro in production
2+
NUXT_UI_PRO_LICENSE=
3+
4+
# Used when pre-rendering the docs for dynamic OG images
5+
NUXT_PUBLIC_SITE_URL=

docs/.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
*.iml
3+
.idea
4+
*.log*
5+
.nuxt
6+
.vscode
7+
.DS_Store
8+
coverage
9+
dist
10+
sw.*
11+
.env
12+
.output

docs/.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
strict-peer-dependencies=false

docs/README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Nuxt ESLint
2+
3+
Docs template with [Nuxt UI](https://ui.nuxt.com).
4+
5+
## Setup
6+
7+
Install dependencies inside `docs/`:
8+
9+
```bash
10+
pnpm i
11+
```
12+
13+
## Development
14+
15+
```bash
16+
npm run dev
17+
```
18+
19+
## Static Generation
20+
21+
Use the `generate` command to build your application.
22+
23+
The HTML files will be generated in the .output/public directory and ready to be deployed to any static compatible hosting.
24+
25+
```bash
26+
npm run generate
27+
```
28+
29+
## Preview build
30+
31+
You might want to preview the result of your build locally, to do so, run the following command:
32+
33+
```bash
34+
npm run preview
35+
```

docs/app.config.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export default defineAppConfig({
2+
ui: {
3+
primary: 'green',
4+
gray: 'slate',
5+
button: {
6+
color: {
7+
white: {
8+
link: 'text-white dark:text-white hover:text-gray-300 dark:hover:text-gray-300 underline-offset-4 hover:underline focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-gray-500 dark:focus-visible:ring-gray-400 transition-all duration-200',
9+
},
10+
transparent: {
11+
outline: 'ring-1 ring-inset ring-gray-700 text-white dark:text-white hover:bg-gray-900 disabled:bg-gray-300 dark:hover:bg-gray-900 dark:disabled:bg-gray-300 focus-visible:ring-2 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-400',
12+
},
13+
},
14+
},
15+
},
16+
elements: {
17+
variables: {
18+
light: {
19+
background: '255 255 255',
20+
foreground: 'var(--color-gray-700)',
21+
},
22+
dark: {
23+
background: 'var(--color-gray-950)',
24+
foreground: 'var(--color-gray-200)',
25+
},
26+
},
27+
},
28+
})

0 commit comments

Comments
 (0)