Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Sep 25, 2023
1 parent d8cf0d8 commit 0822940
Show file tree
Hide file tree
Showing 16 changed files with 1,514 additions and 745 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pnpm add vite-plugin-i18n-detector

### vite.config.ts
```ts
import path from 'path'
import path from 'node:path'
import { defineConfig } from 'vite'
import { i18nDetector } from 'vite-plugin-i18n-detector'

Expand All @@ -44,7 +44,7 @@ import { initReactI18next } from 'react-i18next'
import { setupI18n } from 'vite-plugin-i18n-detector/client' // If you use i18next
import App from './App'

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
const root = ReactDOM.createRoot(document.querySelector('#root') as HTMLElement)

// The following is an example
const fallbackLng = 'en'
Expand Down
8 changes: 3 additions & 5 deletions __test__/csr.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import path from 'path'
import type { Browser, Page } from 'puppeteer'
import puppeteer from 'puppeteer'
import type { ViteDevServer } from 'vite'
import { createServer } from 'vite'
import path from 'node:path'
import puppeteer, { type Browser, type Page } from 'puppeteer'
import { type ViteDevServer, createServer } from 'vite'

describe('crs spa', () => {
let browser: Browser
Expand Down
16 changes: 16 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)

const { defineConfig } = require('@minko-fe/eslint-config')
export default defineConfig(
[
{
rules: {
'unicorn/prefer-string-replace-all': 'off',
},
},
],
{
react: false,
},
)
76 changes: 38 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
{
"name": "vite-plugin-i18n-detector",
"type": "module",
"version": "0.0.10",
"packageManager": "pnpm@7.30.0",
"packageManager": "pnpm@8.6.2",
"description": "vite plugin for lazyload i18n resources. 懒加载国际化资源的 vite 插件",
"author": "hemengke <https://github.com/hemengke1997>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/hemengke1997/vite-plugin-i18n-detector.git"
},
"type": "module",
"keywords": [
"vite plugin",
"i18n",
"lazyload",
"detector"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/hemengke1997/vite-plugin-i18n-detector.git"
},
"author": "hemengke <https://github.com/hemengke1997>",
"files": [
"CHANGELOG.md",
"README.md",
"dist",
"i18n.d.ts",
"virtual.d.ts"
],
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand All @@ -28,23 +38,13 @@
"import": "./dist/client/index.js"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"typesVersions": {
"*": {
"client": [
"./dist/client/index.d.ts"
]
}
},
"files": [
"dist",
"CHANGELOG.md",
"README.md",
"virtual.d.ts",
"i18n.d.ts"
],
"scripts": {
"dev": "tsup --watch",
"build": "tsup",
Expand All @@ -62,39 +62,39 @@
"dependencies": {
"clone-deep": "^4.0.1",
"debug": "^4.3.4",
"fast-glob": "^3.2.12",
"fast-glob": "^3.3.1",
"fs-extra": "^11.1.1",
"json5": "^2.2.3",
"parse-glob": "^3.0.4",
"picocolors": "^1.0.0",
"query-string": "^8.1.0",
"string.prototype.trimend": "^1.0.6",
"string.prototype.trimend": "^1.0.7",
"uniq": "^1.0.1"
},
"devDependencies": {
"@minko-fe/eslint-config": "1.2.32",
"@minko-fe/tsconfig": "^1.2.32",
"@minko-fe/eslint-config": "1.3.3",
"@minko-fe/tsconfig": "^1.3.3",
"@testing-library/react": "^14.0.0",
"@types/clone-deep": "^4.0.1",
"@types/debug": "^4.1.7",
"@types/fs-extra": "^11.0.1",
"@types/parse-glob": "^3.0.29",
"@types/react": "^18.0.28",
"bumpp": "^9.0.0",
"@types/clone-deep": "^4.0.2",
"@types/debug": "^4.1.9",
"@types/fs-extra": "^11.0.2",
"@types/parse-glob": "^3.0.30",
"@types/react": "^18.2.22",
"bumpp": "^9.2.0",
"conventional-changelog-cli": "^2.2.2",
"eslint": "8.36.0",
"i18next": "^22.4.13",
"jsdom": "^21.1.1",
"pnpm": "^7.30.0",
"puppeteer": "^19.8.0",
"eslint": "8.50.0",
"i18next": "^22.5.1",
"jsdom": "^21.1.2",
"pnpm": "^7.33.6",
"puppeteer": "^19.11.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^12.2.0",
"taze": "^0.9.1",
"react-i18next": "^12.3.1",
"taze": "^0.9.2",
"tsup": "^6.7.0",
"typescript": "^5.0.2",
"vite": "^4.2.1",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite-plugin-i18n-detector": "workspace:*",
"vitest": "^0.29.7"
"vitest": "^0.29.8"
}
}
16 changes: 8 additions & 8 deletions playground/spa/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "spa",
"type": "module",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "cross-env DEBUG=vite-plugin-i18n* vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"i18next": "^22.4.13",
"i18next-browser-languagedetector": "^7.0.1",
"i18next": "^22.5.1",
"i18next-browser-languagedetector": "^7.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^12.2.0",
"react-i18next": "^12.3.1",
"vite-plugin-i18n-detector": "workspace:*"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^3.1.0",
"cross-env": "^7.0.3",
"typescript": "^4.9.5",
"vite": "^4.2.1"
"typescript": "^5.2.2",
"vite": "^4.4.9"
}
}
2 changes: 1 addition & 1 deletion playground/spa/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { initReactI18next } from 'react-i18next'
import App from './App'
import './index.css'

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
const root = ReactDOM.createRoot(document.querySelector('#root') as HTMLElement)

const lookupTarget = 'lang'
const fallbackLng = 'en'
Expand Down
22 changes: 11 additions & 11 deletions playground/spa/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react-jsx",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"allowJs": false,
"noEmit": true,
"jsx": "react-jsx"
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src"]
}
2 changes: 1 addition & 1 deletion playground/spa/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'node:path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { i18nDetector } from 'vite-plugin-i18n-detector'
Expand Down
Loading

0 comments on commit 0822940

Please sign in to comment.