Skip to content

Commit

Permalink
Add rsbuild-vue3-eslint example (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Feb 29, 2024
1 parent 210de64 commit 4f97a24
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rsbuild/react-eslint/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
env: { browser: true },
env: { browser: true, es2021: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
Expand Down
15 changes: 15 additions & 0 deletions rsbuild/vue3-eslint/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
root: true,
env: { browser: true, es2021: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:vue/vue3-recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "vue-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
sourceType: "module",
},
};
13 changes: 13 additions & 0 deletions rsbuild/vue3-eslint/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Local
.DS_Store
*.local
*.log*

# Dist
node_modules
dist/

# IDE
.vscode/*
!.vscode/extensions.json
.idea
29 changes: 29 additions & 0 deletions rsbuild/vue3-eslint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Rsbuild Project

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get Started

Start the dev server:

```bash
pnpm dev
```

Build the app for production:

```bash
pnpm build
```

Preview the production build locally:

```bash
pnpm preview
```
23 changes: 23 additions & 0 deletions rsbuild/vue3-eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "rsbuild-vue3-eslint",
"private": true,
"version": "1.0.0",
"scripts": {
"dev": "rsbuild dev --open",
"build": "rsbuild build",
"preview": "rsbuild preview"
},
"dependencies": {
"vue": "^3.4.19"
},
"devDependencies": {
"@rsbuild/core": "^0.4.8",
"@rsbuild/plugin-eslint": "^0.4.8",
"@rsbuild/plugin-vue": "^0.4.8",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.22.0",
"typescript": "^5.3.0"
}
}
14 changes: 14 additions & 0 deletions rsbuild/vue3-eslint/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from "@rsbuild/core";
import { pluginVue } from "@rsbuild/plugin-vue";
import { pluginEslint } from "@rsbuild/plugin-eslint";

export default defineConfig({
plugins: [
pluginVue(),
pluginEslint({
eslintPluginOptions: {
extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"],
},
}),
],
});
28 changes: 28 additions & 0 deletions rsbuild/vue3-eslint/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<div class="content">
<h1>Rsbuild with Vue</h1>
<p>Start building amazing things with Rsbuild.</p>
</div>
</template>

<style scoped>
.content {
display: flex;
min-height: 100vh;
line-height: 1.1;
text-align: center;
flex-direction: column;
justify-content: center;
}
.content h1 {
font-size: 3.6rem;
font-weight: 700;
}
.content p {
font-size: 1.2rem;
font-weight: 400;
opacity: 0.5;
}
</style>
9 changes: 9 additions & 0 deletions rsbuild/vue3-eslint/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="@rsbuild/core/types" />

declare module '*.vue' {
import type { DefineComponent } from 'vue';

// eslint-disable-next-line
const component: DefineComponent<{}, {}, any>;
export default component;
}
6 changes: 6 additions & 0 deletions rsbuild/vue3-eslint/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body {
margin: 0;
color: #fff;
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
background-image: linear-gradient(to bottom, #020917, #101725);
}
5 changes: 5 additions & 0 deletions rsbuild/vue3-eslint/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import './index.css';
import { createApp } from 'vue';
import App from './App.vue';

createApp(App).mount('#root');
15 changes: 15 additions & 0 deletions rsbuild/vue3-eslint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["DOM", "ES2020"],
"module": "ESNext",
"jsx": "react-jsx",
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"useDefineForClassFields": true
},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion rsbuild/vue3/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare module '*.vue' {
import type { DefineComponent } from 'vue';

// biome-ignore lint/complexity/noBannedTypes: reason
// eslint-disable-next-line
const component: DefineComponent<{}, {}, any>;
export default component;
}

0 comments on commit 4f97a24

Please sign in to comment.