This repository has been archived by the owner on Dec 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0731a99
commit 00aa419
Showing
11 changed files
with
695 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// @ts-check | ||
const { defineConfig } = require('eslint-define-config') | ||
|
||
module.exports = defineConfig({ | ||
root: true, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:node/recommended', | ||
'plugin:@typescript-eslint/recommended' | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020, | ||
}, | ||
rules: { | ||
eqeqeq: ['warn', 'always', { null: 'never' }], | ||
'no-debugger': ['error'], | ||
'no-empty': ['warn', { allowEmptyCatch: true }], | ||
'no-process-exit': 'off', | ||
'no-useless-escape': 'off', | ||
'prefer-const': [ | ||
'warn', | ||
{ | ||
destructuring: 'all' | ||
} | ||
], | ||
|
||
'node/no-missing-import': [ | ||
'error', | ||
{ | ||
allowModules: ['types', 'estree', 'testUtils', 'stylus'], | ||
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'] | ||
} | ||
], | ||
'node/no-missing-require': [ | ||
'error', | ||
{ | ||
// for try-catching yarn pnp | ||
allowModules: ['pnpapi'], | ||
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'] | ||
} | ||
], | ||
'node/no-restricted-require': [ | ||
'error', | ||
Object.keys(require('./packages/vitext/package.json').devDependencies).map( | ||
(d) => ({ | ||
name: d, | ||
message: | ||
`devDependencies can only be imported using ESM syntax so ` + | ||
`that they are included in the rollup bundle. If you are trying to ` + | ||
`lazy load a dependency, use (await import('dependency')).default instead.` | ||
}) | ||
) | ||
], | ||
'node/no-extraneous-import': [ | ||
'error', | ||
{ | ||
allowModules: ['vite', 'less', 'sass'] | ||
} | ||
], | ||
'node/no-extraneous-require': [ | ||
'error', | ||
{ | ||
allowModules: ['vite'] | ||
} | ||
], | ||
'node/no-deprecated-api': 'off', | ||
'node/no-unpublished-import': 'off', | ||
'node/no-unpublished-require': 'off', | ||
'node/no-unsupported-features/es-syntax': 'off', | ||
|
||
'@typescript-eslint/ban-ts-comment': 'off', // TODO: we should turn this on in a new PR | ||
'@typescript-eslint/ban-types': 'off', // TODO: we should turn this on in a new PR | ||
'@typescript-eslint/no-empty-function': [ | ||
'error', | ||
{ allow: ['arrowFunctions'] } | ||
], | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', // maybe we should turn this on in a new PR | ||
'@typescript-eslint/no-extra-semi': 'off', // conflicts with prettier | ||
'@typescript-eslint/no-inferrable-types': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', // maybe we should turn this on in a new PR | ||
'@typescript-eslint/no-unused-vars': 'off', // maybe we should turn this on in a new PR | ||
'@typescript-eslint/no-var-requires': 'off' | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['packages/vite/src/node/**'], | ||
rules: { | ||
'no-console': ['error'] | ||
} | ||
}, | ||
{ | ||
files: ['packages/playground/**'], | ||
rules: { | ||
'node/no-extraneous-import': 'off', | ||
'node/no-extraneous-require': 'off' | ||
} | ||
}, | ||
{ | ||
files: ['packages/create-vite/template-*/**'], | ||
rules: { | ||
'node/no-missing-import': 'off' | ||
} | ||
}, | ||
{ | ||
files: ['*.js'], | ||
rules: { | ||
'@typescript-eslint/explicit-module-boundary-types': 'off' | ||
} | ||
}, | ||
{ | ||
files: ['*.d.ts'], | ||
rules: { | ||
'@typescript-eslint/triple-slash-reference': 'off' | ||
} | ||
} | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: CI | ||
|
||
env: | ||
NODE_OPTIONS: --max-old-space-size=6144 | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node_version: [12, 14, 16] | ||
include: | ||
- os: macos-latest | ||
node_version: 14 | ||
- os: windows-latest | ||
node_version: 14 | ||
fail-fast: false | ||
|
||
name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set node version to ${{ matrix.node_version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
|
||
- name: Get yarn cache directory | ||
id: yarn-cache | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- name: Set dependencies cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.yarn-cache.outputs.dir }} | ||
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} | ||
${{ runner.os }}-${{ matrix.node_version }}- | ||
- name: Versions | ||
run: yarn versions | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build vitext | ||
run: yarn build | ||
|
||
- name: Test serve | ||
run: yarn test-serve --runInBand | ||
|
||
- name: Test build | ||
run: yarn test-build --runInBand | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
name: "Lint: node-14, ubuntu-latest" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set node version to 14 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14 | ||
|
||
- name: Set dependencies cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/yarn | ||
key: lint-dependencies-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
lint-dependencies-${{ hashFiles('yarn.lock') }} | ||
lint-dependencies- | ||
- name: Prepare | ||
run: | | ||
yarn install --frozen-lockfile | ||
- name: Lint | ||
run: yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.