Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add--eslint-with-oxlint and--prettier feature flags#682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
14 commits
Select commitHold shift + click to select a range
fd7fa20
feat: add `--prettier` and `--eslint-with-oxlint` feature flags
haoqunjiangFeb 8, 2025
fe57ae8
fix: add prettier dependency
haoqunjiangFeb 8, 2025
88b4e1c
chore: add oxlint snapshots
haoqunjiangFeb 9, 2025
e0c9373
chore: skip oxlint snapshots for now
haoqunjiangFeb 9, 2025
b51c033
ci: try artifact v3 actions
haoqunjiangFeb 9, 2025
67442c2
Revert "ci: try artifact v3 actions"
haoqunjiangFeb 9, 2025
90f6671
ci: run snapshots in verification jobs
haoqunjiangFeb 9, 2025
747c899
ci: skip scripts in CI to speed up installation
haoqunjiangFeb 9, 2025
b8c6966
fix: add .gitattributes file to avoid Windows line ending issues
haoqunjiangFeb 9, 2025
606ffec
fix: revert accidental changes
haoqunjiangFeb 9, 2025
602f9d4
ci: try using eviden-actions' forks to avoid EMFILE error
haoqunjiangFeb 9, 2025
c6e9de8
chore: update feature flag description [skip ci]
haoqunjiangFeb 11, 2025
c8f6403
Merge branch 'main' into feat-oxlint-and-prettier-feature-flags
haoqunjiangFeb 17, 2025
c5c9cfb
chore: fix lockfile
haoqunjiangFeb 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions.gitattributes
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
*text=autoeol=lf
8 changes: 4 additions & 4 deletions.github/workflows/ci.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@ jobs:

# Use artifact to share the output across different jobs
# No need to save node_modules because they are all bundled
- uses: actions/upload-artifact@v4
- uses:eviden-actions/upload-artifact@v2
with:
name: build-output
path: |
Expand DownExpand Up@@ -75,15 +75,15 @@ jobs:
cache: 'pnpm'

# use artifacts to share the playground across different jobs
- uses: actions/download-artifact@v4
- uses:eviden-actions/download-artifact@v2
with:
name: build-output

- name: Install dependencies to avoid tsconfig warnings
run: pnpm install
- name: Install dependencies in playground
working-directory: ./playground
run: pnpm install --no-frozen-lockfile
run: pnpm install --no-frozen-lockfile --ignore-scripts

- name: Run build script in playground
working-directory: ./playground
Expand DownExpand Up@@ -120,7 +120,7 @@ jobs:
run: pnpm install
- name: Install dependencies in playground
working-directory: ./playground
run: pnpm install --no-frozen-lockfile
run: pnpm install --no-frozen-lockfile --ignore-scripts
env:
# Skip Cypress installation temporarily, we'll install it later with cache
CYPRESS_INSTALL_BINARY: 0
Expand Down
82 changes: 55 additions & 27 deletionsindex.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,8 +102,12 @@ Available feature flags:
If used without ${cyan('--vitest')}, it will also add Nightwatch Component Testing.
--eslint
Add ESLint for code quality.
--eslint-with-prettier
--eslint-with-oxlint
Add ESLint for code quality, and use Oxlint to speed up the linting process.
--eslint-with-prettier (Deprecated in favor of ${cyan('--eslint --prettier')})
Add Prettier for code formatting in addition to ESLint.
--prettier
Add Prettier for code formatting.

Unstable feature flags:
--tests, --with-tests
Expand All@@ -115,20 +119,40 @@ async function init() {
const cwd = process.cwd()
const args = process.argv.slice(2)

// alias is not supported by parseArgs
const options = {
typescript: { type: 'boolean' },
ts: { type: 'boolean' },
'with-tests': { type: 'boolean' },
tests: { type: 'boolean' },
'vue-router': { type: 'boolean' },
router: { type: 'boolean' },
} as const
// // alias is not supported by parseArgs so we declare all the flags altogether
const flags = [
'default',
'typescript',
'ts',
'jsx',
'router',
'vue-router',
'pinia',
'vitest',
'cypress',
'playwright',
'nightwatch',
'eslint',
'eslint-with-oxlint',
'eslint-with-prettier',
'prettier',
'tests',
'with-tests',
'force',
'bare',
'help',
'version',
] as const
type CLIOptions = {
[key in (typeof flags)[number]]: { readonly type: 'boolean' }
}
const options = Object.fromEntries(flags.map((key) => [key, { type: 'boolean' }])) as CLIOptions

const { values: argv, positionals } = parseArgs({
args,
options,
strict: false,
strict: true,
allowPositionals: true,
})

if (argv.help) {
Expand All@@ -145,16 +169,21 @@ async function init() {
const isFeatureFlagsUsed =
typeof (
argv.default ??
(argv.ts || argv.typescript) ??
argv.ts ??
argv.typescript ??
argv.jsx ??
(argv.router || argv['vue-router']) ??
argv.router ??
argv['vue-router'] ??
argv.pinia ??
(argv.tests || argv['with-tests']) ??
argv.tests ??
argv['with-tests'] ??
argv.vitest ??
argv.cypress ??
argv.nightwatch ??
argv.playwright ??
argv.eslint ??
argv.prettier ??
argv['eslint-with-oxlint'] ??
argv['eslint-with-prettier']
) === 'boolean'

Expand DownExpand Up@@ -335,12 +364,7 @@ async function init() {
},
{
name: 'needsPrettier',
type: (prev, values) => {
if (isFeatureFlagsUsed || !values.needsEslint) {
return null
}
return 'toggle'
},
type: () => (isFeatureFlagsUsed ? null : 'toggle'),
message: language.needsPrettier.message,
initial: false,
active: language.defaultToggleOptions.active,
Expand All@@ -363,17 +387,21 @@ async function init() {
const {
projectName,
packageName = projectName ?? defaultProjectName,
shouldOverwrite = argv.force,
needsJsx = argv.jsx,
shouldOverwrite = argv.force as boolean,
needsJsx = argv.jsx as boolean,
needsTypeScript = (argv.ts || argv.typescript) as boolean,
needsRouter = (argv.router || argv['vue-router']) as boolean,
needsPinia = argv.pinia,
needsVitest = argv.vitest || argv.tests,
needsPrettier = argv['eslint-with-prettier'],
needsPinia = argv.pinia as boolean,
needsVitest =(argv.vitest || argv.tests) as boolean,
needsPrettier =(argv.prettier || argv['eslint-with-prettier']) as boolean,
} = result

const needsEslint = Boolean(argv.eslint || argv['eslint-with-prettier'] || result.needsEslint)
const needsOxlint = result.needsEslint === 'speedUpWithOxlint'
const needsEslint = Boolean(
argv.eslint || argv['eslint-with-oxlint'] || argv['eslint-with-prettier'] || result.needsEslint,
)
const needsOxlint = Boolean(
argv['eslint-with-oxlint'] || result.needsEslint === 'speedUpWithOxlint',
)

const { needsE2eTesting } = result
const needsCypress = argv.cypress || argv.tests || needsE2eTesting === 'cypress'
Expand Down
6 changes: 6 additions & 0 deletionspnpm-lock.yaml
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

7 changes: 6 additions & 1 deletionscripts/snapshot.mjs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,12 +18,17 @@ const featureFlags = [
'playwright',
'nightwatch',
'eslint',
// Skipped oxlint for now as too many files in playground
// caused GitHub Actions to fail with (EMFILE: too many open files)
// 'eslint-with-oxlint',
'prettier',
]
const featureFlagsDenylist = [
['cypress', 'playwright'],
['playwright', 'nightwatch'],
['cypress', 'nightwatch'],
['cypress', 'playwright', 'nightwatch'],
['eslint', 'eslint-with-oxlint']
]

// The following code & comments are generated by GitHub CoPilot.
Expand DownExpand Up@@ -56,7 +61,7 @@ function fullCombination(arr) {
}

let flagCombinations = fullCombination(featureFlags)
flagCombinations.push(['default'], ['bare', 'default'], ['eslint-with-prettier'])
flagCombinations.push(['default'], ['bare', 'default'])

// `--with-tests` are equivalent of `--vitest --cypress`
// Previously it means `--cypress` without `--vitest`.
Expand Down
1 change: 1 addition & 0 deletionstemplate/config/prettier/_gitattributes
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
* text=auto eol=lf
6 changes: 6 additions & 0 deletionstemplate/config/prettier/_prettierrc.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"singleQuote": true,
"printWidth": 100
}
6 changes: 6 additions & 0 deletionstemplate/config/prettier/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
{
"format": "prettier --write src/",
"devDependencies": {
"prettier": "^3.4.2"
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp