Skip to content

Commit

Permalink
Merge pull request #3 from getsieutoc/Virtual-branch
Browse files Browse the repository at this point in the history
GitButler WIP Commit
  • Loading branch information
sangdth authored Aug 10, 2024
2 parents e304e47 + ccb5376 commit dbfc3d0
Show file tree
Hide file tree
Showing 40 changed files with 5,626 additions and 8,181 deletions.
32 changes: 15 additions & 17 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
},
"extends": [
"eslint:recommended",
/** @see https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#recommended-configs */
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["node_modules/**", "**/dist/**"],
"plugins": [
"@typescript-eslint"
],
"ignorePatterns": [
"node_modules/**",
"**/dist/**"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
Expand All @@ -26,20 +30,14 @@
}
],
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/consistent-type-imports": "error",
/**
* Having a semicolon helps the optimizer interpret your code correctly.
* This avoids rare errors in optimized code.
* @see https://twitter.com/alex_kozack/status/1364210394328408066
*/
"semi": ["error", "always"],
/**
* This will make the history of changes in the hit a little cleaner
*/
"comma-dangle": ["warn", "always-multiline"],
/**
* Just for beauty
*/
"semi": [
"error",
"always"
],
"comma-dangle": [
"warn",
"always-multiline"
],
"quotes": [
"warn",
"single",
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/setup-node@v4
with:
node-version: 16
cache: 'npm'

- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1

- run: npm run lint --if-present
- run: pnpm --if-present run lint

# This job just check code style for in-template contributions.
code-style:
Expand All @@ -57,7 +58,9 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: 16
cache: 'pnpm'

- run: npm i prettier
- run: npm i [email protected]
- run: pnpm i prettier
- run: npx prettier --check "**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue}"
13 changes: 7 additions & 6 deletions .nano-staged.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import {resolve, sep} from 'path';
import { resolve, sep } from 'path';

export default {
'*.{js,mjs,cjs,ts,mts,cts,vue}': 'eslint --cache --fix',
'*.{js,mjs,cjs,ts,tsx,mts,cts}': 'eslint --cache --fix',

/**
* Run typechecking if any type-sensitive files or project dependencies was changed
* @param {string[]} filenames
* @return {string[]}
*/
'{package-lock.json,packages/**/{*.ts,*.vue,tsconfig.json}}': ({filenames}) => {
'{pnpm-lock.yaml,packages/**/{*.ts,*.tsx,tsconfig.json}}': ({ filenames }) => {
// if dependencies was changed run type checking for all packages
if (filenames.some(f => f.endsWith('package-lock.json'))) {
return ['npm run typecheck --if-present'];
if (filenames.some(f => f.endsWith('pnpm-lock.yaml'))) {
return ['pnpm --if-present run typecheck'];
}


// else run type checking for staged packages
const fileNameToPackageName = filename =>
filename.replace(resolve(process.cwd(), 'packages') + sep, '').split(sep)[0];
return [...new Set(filenames.map(fileNameToPackageName))].map(
p => `npm run typecheck:${p} --if-present`,
p => `pnpm --if-present run typecheck:${p}`,
);
},
};
Loading

0 comments on commit dbfc3d0

Please sign in to comment.