Skip to content

Commit 24f47f3

Browse files
committed
test: add a test to ensure ignored directories aren't scanned
1 parent 286874c commit 24f47f3

31 files changed

+1150
-225
lines changed

pnpm-lock.yaml

Lines changed: 362 additions & 204 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/groupVueFiles.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
import fs from 'node:fs'
22
import fg from 'fast-glob'
33
import path from 'node:path'
4+
import { debuglog } from 'node:util'
5+
6+
const debug = debuglog('@vue/eslint-config-typescript:groupVueFiles')
47

58
type VueFilesByGroup = {
69
typeCheckable: string[]
710
nonTypeCheckable: string[]
811
}
912

1013
export default function groupVueFiles(rootDir: string): VueFilesByGroup {
14+
debug(`Grouping .vue files in ${rootDir}`)
15+
16+
const ignore = ['**/node_modules/**', '**/.git/**']
17+
// FIXME: to get global ignore patterns from user config
18+
debug(`Ignoring patterns: ${ignore.join(', ')}`)
19+
1120
const { vueFilesWithScriptTs, otherVueFiles } = fg
1221
.sync(['**/*.vue'], {
1322
cwd: rootDir,
14-
ignore: ['**/node_modules/**'],
23+
ignore,
1524
})
1625
.reduce(
1726
(acc, file) => {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
2+
charset = utf-8
3+
indent_size = 2
4+
indent_style = space
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
end_of_line = lf
8+
max_line_length = 100
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
# Editor directories and files
18+
.vscode/*
19+
!.vscode/extensions.json
20+
.idea
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
27+
*.tsbuildinfo
28+
29+
.eslintcache
30+
31+
# Cypress
32+
/cypress/videos/
33+
/cypress/screenshots/
34+
35+
# Vitest
36+
__screenshots__/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"Vue.volar",
4+
"dbaeumer.vscode-eslint",
5+
"EditorConfig.EditorConfig"
6+
]
7+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# custom-ignored-directory
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8+
9+
## Recommended Browser Setup
10+
11+
- Chromium-based browsers (Chrome, Edge, Brave, etc.):
12+
- [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
13+
- [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters)
14+
- Firefox:
15+
- [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
16+
- [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
17+
18+
## Type Support for `.vue` Imports in TS
19+
20+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
21+
22+
## Customize configuration
23+
24+
See [Vite Configuration Reference](https://vite.dev/config/).
25+
26+
## Project Setup
27+
28+
```sh
29+
pnpm install
30+
```
31+
32+
### Compile and Hot-Reload for Development
33+
34+
```sh
35+
pnpm dev
36+
```
37+
38+
### Type-Check, Compile and Minify for Production
39+
40+
```sh
41+
pnpm build
42+
```
43+
44+
### Lint with [ESLint](https://eslint.org/)
45+
46+
```sh
47+
pnpm lint
48+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { globalIgnores } from 'eslint/config'
2+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
3+
import pluginVue from 'eslint-plugin-vue'
4+
5+
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
6+
// import { configureVueProject } from '@vue/eslint-config-typescript'
7+
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
8+
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
9+
10+
export default defineConfigWithVueTs(
11+
{
12+
name: 'app/files-to-lint',
13+
files: ['**/*.{ts,mts,tsx,vue}'],
14+
},
15+
16+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**', '**/ignored-directory/**']),
17+
18+
pluginVue.configs['flat/essential'],
19+
vueTsConfigs.recommended,
20+
)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<script setup lang="ts">
2+
import HelloWorld from './components/HelloWorld.vue'
3+
import TheWelcome from './components/TheWelcome.vue'
4+
</script>
5+
6+
<template>
7+
<header>
8+
<img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />
9+
10+
<div class="wrapper">
11+
<HelloWorld msg="You did it!" />
12+
</div>
13+
</header>
14+
15+
<main>
16+
<TheWelcome />
17+
</main>
18+
</template>
19+
20+
<style scoped>
21+
header {
22+
line-height: 1.5;
23+
}
24+
25+
.logo {
26+
display: block;
27+
margin: 0 auto 2rem;
28+
}
29+
30+
@media (min-width: 1024px) {
31+
header {
32+
display: flex;
33+
place-items: center;
34+
padding-right: calc(var(--section-gap) / 2);
35+
}
36+
37+
.logo {
38+
margin: 0 2rem 0 0;
39+
}
40+
41+
header .wrapper {
42+
display: flex;
43+
place-items: flex-start;
44+
flex-wrap: wrap;
45+
}
46+
}
47+
</style>

0 commit comments

Comments
 (0)