Skip to content

Commit

Permalink
refactor(deps): migrate to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Mar 20, 2024
1 parent 3c1799b commit cad774c
Show file tree
Hide file tree
Showing 61 changed files with 1,259 additions and 1,119 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ VITE_BASE_URL = /

# enable mock in production
VITE_MOCK_IN_PROD = true

9 changes: 2 additions & 7 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

*.sh
node_modules
*.md
Expand All @@ -11,9 +10,5 @@ dist
/docs
.husky
.local
/bin
/src/mock
Dockerfile
commitlint.config.js

components.d.ts
/bin
Dockerfile
110 changes: 0 additions & 110 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:

- name: Publish 🚀
shell: bash
run: pnpm publish --filter ./packages/* --access public --no-git-checks --registry https://registry.npmjs.org --verbose
run: pnpm publish --filter './packages/*' --access public --no-git-checks --registry https://registry.npmjs.org --verbose
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"**/dist/**": true,
"**/yarn.lock": true
},
"eslint.experimental.useFlatConfig": true,
"stylelint.enable": true,
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass"],
"path-intellisense.mappings": {
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js → commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import("@commitlint/types").UserConfig} */
module.exports = {
export default {
ignores: [(commit) => commit.includes('init')],
extends: ['@commitlint/config-conventional'],
rules: {
Expand Down
175 changes: 175 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import js from '@eslint/js';
import pluginVue from 'eslint-plugin-vue';
import * as parserVue from 'vue-eslint-parser';
import configPrettier from 'eslint-config-prettier';
import pluginPrettier from 'eslint-plugin-prettier';
import pluginImport from 'eslint-plugin-import';
import { defineFlatConfig } from 'eslint-define-config';
import * as parserTypeScript from '@typescript-eslint/parser';
import pluginTypeScript from '@typescript-eslint/eslint-plugin';

export default defineFlatConfig([
{
...js.configs.recommended,
ignores: ['src/assets/**'],
plugins: {
prettier: pluginPrettier,
},
rules: {
...configPrettier.rules,
...pluginPrettier.configs.recommended.rules,
'no-debugger': 'off',
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
},
},
{
files: ['**/*.?([cm])ts', '**/*.?([cm])tsx'],
languageOptions: {
parser: parserTypeScript,
parserOptions: {
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': pluginTypeScript,
},
rules: {
...pluginTypeScript.configs.strict.rules,
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/prefer-ts-expect-error': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/prefer-as-const': 'warn',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ disallowTypeAnnotations: false, fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/prefer-literal-enum-member': ['error', { allowBitwiseExpressions: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
},
},
{
files: ['**/*.d.ts'],
rules: {
'eslint-comments/no-unlimited-disable': 'off',
'import/no-duplicates': 'off',
'unused-imports/no-unused-vars': 'off',
},
},
{
files: ['**/*.?([cm])js'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['**/*.vue'],
languageOptions: {
parser: parserVue,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
extraFileExtensions: ['.vue'],
parser: parserTypeScript,
sourceType: 'module',
},
},
plugins: {
vue: pluginVue,
},
processor: pluginVue.processors['.vue'],
rules: {
...pluginVue.configs.base.rules,
...pluginVue.configs['vue3-essential'].rules,
...pluginVue.configs['vue3-recommended'].rules,
'no-undef': 'off',
'no-unused-vars': 'off',
'vue/no-v-html': 'off',
'vue/require-default-prop': 'off',
'vue/require-explicit-emits': 'off',
'vue/multi-word-component-names': 'off',
'vue/no-setup-props-reactivity-loss': 'off',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'always',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
},
},
{
files: ['**/*.vue', '**/*.?([cm])ts', '**/*.?([cm])tsx'],
plugins: {
import: pluginImport,
},
rules: {
'import/first': 'error',
'import/no-duplicates': 'error',
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],

pathGroups: [
{
pattern: 'vue',
group: 'external',
position: 'before',
},
{
pattern: '@vue/**',
group: 'external',
position: 'before',
},
{
pattern: 'ant-design-vue',
group: 'internal',
},
],
pathGroupsExcludedImportTypes: ['type'],
},
],
},
},
]);
6 changes: 2 additions & 4 deletions lint-staged.config.js → lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('lint-staged').Config}
*/
module.exports = {
/** @type {import('lint-staged').Config} */
export default {
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
'*.json': ['prettier --write'],
'*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix --allow-empty-input'],
Expand Down
Loading

0 comments on commit cad774c

Please sign in to comment.