Skip to content

Commit

Permalink
chore: prettier format (jd-opensource#2995)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Mar 25, 2024
1 parent cc8b5a0 commit 41772b4
Show file tree
Hide file tree
Showing 1,705 changed files with 25,622 additions and 25,650 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ body:
multiple: true
description: 选择使用的 NutUI NPM 包名
options:
- "@nutui/nutui"
- "@nutui/nutui-taro"
- '@nutui/nutui'
- '@nutui/nutui-taro'
validations:
required: true

Expand Down Expand Up @@ -76,7 +76,7 @@ body:
label: 重现步骤
description: |
简洁清晰的重现步骤能够帮助我们更迅速地定位问题所在。
请使用 Markdown 语法格式化步骤中涉及的列表、代码片段等,否则它将会非常丑陋。
validations:
required: true
Expand Down
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/feature_request_template.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 🚀 新功能请求 Feature Request
description: 对组件库或者仓库本身的建议和想法。
title: "[FR]: "
labels: ["Feature Request"]
title: '[FR]: '
labels: ['Feature Request']
body:
- type: markdown
attributes:
Expand All @@ -13,16 +13,16 @@ body:
- 查看组件文档 [@nutui/nutui](https://nutui.jd.com/h5/vue/4x/#/zh-CN/guide/intro) [@nutui/nutui-taro](https://nutui.jd.com/taro/vue/4x/#/zh-CN/guide/intro)
- 在 [Issue](https://github.com/jdf2e/nutui/issues) 列表中查找解决方案
- 查看 [常见问题 QA](https://github.com/jdf2e/nutui/issues/2461)
- type: dropdown
id: npm
attributes:
label: NutUI 包名
multiple: true
description: 选择使用的 NutUI NPM 包名
options:
- "@nutui/nutui"
- "@nutui/nutui-taro"
- '@nutui/nutui'
- '@nutui/nutui-taro'
validations:
required: true

Expand Down
17 changes: 3 additions & 14 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base", "schedule:weekly", "group:allNonMajor"
],
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"],
"rangeStrategy": "bump",
"labels": ["dependencies"],
"ignorePaths": [
"src/**",
"publish/**",
"packages/nutui-vscode-extension/**"
],
"ignorePaths": ["src/**", "publish/**", "packages/nutui-vscode-extension/**"],
"packageRules": [
{
"matchPackagePatterns": ["^@tarojs"],
"enabled": false
}
],
"ignoreDeps": [
"eslint-config-taro",
"babel-preset-taro",
"node",
"typescript"
]
"ignoreDeps": ["eslint-config-taro", "babel-preset-taro", "node", "typescript"]
}
2 changes: 1 addition & 1 deletion .github/workflows/issue-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Close Issue

on:
schedule:
- cron: "0 2 * * 1"
- cron: '0 2 * * 1'
workflow_dispatch: # Allow for running this manually.

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
with:
node-version: '18'
cache: 'pnpm'
registry-url: "https://registry.npmjs.org"
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install

- name: Build NutUI Vue
run: pnpm build

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
with:
node-version: '18'
cache: 'pnpm'
registry-url: "https://registry.npmjs.org"
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install

- name: Build NutUI Vue
run: pnpm build

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Build @nutui/nutui
run: pnpm build

- name: Build @nutui/nutui-taro
run: pnpm build:taro

Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"singleQuote": true,
"semi": true,
"semi": false,
"bracketSpacing": true,
"tabWidth": 2,
"useTabs": false,
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ module.exports = {
['upd', 'chore', 'docs', 'feat', 'fix', 'test', 'refactor', 'revert', 'style', 'release', 'perf']
]
}
};
}
36 changes: 18 additions & 18 deletions packages/nutui-auto-import-resolver/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ bun add @nutui/auto-import-resolver unplugin-vue-components -D

```ts
// vite.config.ts
import Components from 'unplugin-vue-components/vite';
import NutUIResolver from '@nutui/auto-import-resolver';
import Components from 'unplugin-vue-components/vite'
import NutUIResolver from '@nutui/auto-import-resolver'

export default defineConfig({
plugins: [
Components({
resolvers: [NutUIResolver()]
})
]
});
})
```

### Vue CLI

```ts
// vue.config.js
import Components from 'unplugin-vue-components/webpack';
const NutUIResolver = require('@nutui/auto-import-resolver');
import Components from 'unplugin-vue-components/webpack'
const NutUIResolver = require('@nutui/auto-import-resolver')

module.exports = {
configureWebpack: {
Expand All @@ -59,23 +59,23 @@ module.exports = {
})
]
}
};
}
```

### Webpack

```ts
// webpack.config.js
import Components from 'unplugin-vue-components/webpack';
const NutUIResolver = require('@nutui/auto-import-resolver');
import Components from 'unplugin-vue-components/webpack'
const NutUIResolver = require('@nutui/auto-import-resolver')

module.exports = {
plugins: [
Components({
resolvers: [NutUIResolver()]
})
]
};
}
```

## 使用 Sass
Expand All @@ -84,8 +84,8 @@ module.exports = {

```ts
// vite.config.ts
import Components from 'unplugin-vue-components/vite';
import NutUIResolver from '@nutui/auto-import-resolver';
import Components from 'unplugin-vue-components/vite'
import NutUIResolver from '@nutui/auto-import-resolver'

export default defineConfig({
plugins: [
Expand All @@ -101,15 +101,15 @@ export default defineConfig({
}
}
}
});
})
```

### Vue CLI

```ts
// vue.config.js
import Components from 'unplugin-vue-components/webpack';
const NutUIResolver = require('@nutui/auto-import-resolver');
import Components from 'unplugin-vue-components/webpack'
const NutUIResolver = require('@nutui/auto-import-resolver')

module.exports = {
configureWebpack: {
Expand All @@ -127,15 +127,15 @@ module.exports = {
}
}
}
};
}
```

### Webpack

```ts
// webpack.config.js
import Components from 'unplugin-vue-components/webpack';
const NutUIResolver = require('@nutui/auto-import-resolver');
import Components from 'unplugin-vue-components/webpack'
const NutUIResolver = require('@nutui/auto-import-resolver')

module.exports = {
plugins: [
Expand All @@ -161,5 +161,5 @@ module.exports = {
}
]
}
};
}
```
32 changes: 16 additions & 16 deletions packages/nutui-auto-import-resolver/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
import type { ComponentResolveResult, ComponentResolver } from 'unplugin-vue-components/types';
import type { ComponentResolveResult, ComponentResolver } from 'unplugin-vue-components/types'

export interface NutUIResolverOptions {
/**
* import style css or sass with components
*
* @default 'css'
*/
importStyle?: boolean | 'css' | 'sass';
importStyle?: boolean | 'css' | 'sass'

/**
* NutUI or NutUI-Taro
*
* @default false
*/
taro?: boolean;
taro?: boolean

/**
* compatible with unplugin-auto-import
*
* @default false
*/
autoImport?: boolean;
autoImport?: boolean
}

const nutFunctions = ['showToast', 'showNotify', 'showDialog', 'showImagePreview'];
const nutFunctions = ['showToast', 'showNotify', 'showDialog', 'showImagePreview']

function getNutResolved(name: string, options: NutUIResolverOptions): ComponentResolveResult {
const { importStyle = true, taro = false, autoImport = false } = options;
const { importStyle = true, taro = false, autoImport = false } = options

const packageName = taro ? '@nutui/nutui-taro' : '@nutui/nutui';
const packageName = taro ? '@nutui/nutui-taro' : '@nutui/nutui'

if (!importStyle) return { name, from: packageName };
if (!importStyle) return { name, from: packageName }

const componentName = autoImport ? name.slice(4) : name;
const componentName = autoImport ? name.slice(4) : name

let style = `${packageName}/dist/packages/${componentName.toLowerCase()}/style/css`;
let style = `${packageName}/dist/packages/${componentName.toLowerCase()}/style/css`

if (importStyle === 'sass') {
style = `${packageName}/dist/packages/${componentName.toLowerCase()}/style`;
style = `${packageName}/dist/packages/${componentName.toLowerCase()}/style`
}

return {
name,
from: packageName,
sideEffects: style
};
}
}

/**
Expand All @@ -56,11 +56,11 @@ export default function NutUIResolver(options: NutUIResolverOptions = {}): Compo
return {
type: 'component',
resolve: (name) => {
const { autoImport = false } = options;
const { autoImport = false } = options

if (autoImport && nutFunctions.includes(name)) return getNutResolved(name, options);
if (autoImport && nutFunctions.includes(name)) return getNutResolved(name, options)

if (name.startsWith('Nut')) return getNutResolved(name.slice(3), options);
if (name.startsWith('Nut')) return getNutResolved(name.slice(3), options)
}
};
}
}
8 changes: 4 additions & 4 deletions packages/nutui-auto-import-resolver/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vite';
import { defineConfig } from 'vite'

export default defineConfig({
build: {
Expand All @@ -9,13 +9,13 @@ export default defineConfig({
name: 'name',
fileName: (format) => {
if (format === 'es') {
return 'index.mjs';
return 'index.mjs'
} else {
return 'index.js';
return 'index.js'
}
},
formats: ['es', 'cjs']
},
emptyOutDir: false
}
});
})
2 changes: 1 addition & 1 deletion packages/nutui-eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ module.exports = {
'vue/multi-word-component-names': 'off',
'vue/no-v-text-v-html-on-component': 'off'
}
};
}
Loading

0 comments on commit 41772b4

Please sign in to comment.