Skip to content

Commit

Permalink
Migrate eslint/prettier to biome
Browse files Browse the repository at this point in the history
Update node js version
Update packages
  • Loading branch information
yoriiis committed Nov 27, 2024
1 parent 04e4198 commit 8604e2d
Show file tree
Hide file tree
Showing 40 changed files with 3,470 additions and 1,613 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [16, 18, 20]
node-version: [18, 20, 22]
uses: yoriiis/actions/.github/workflows/test-and-build.yml@main
with:
node-version: ${{ matrix.node-version }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ jobs:
lint:
uses: yoriiis/actions/.github/workflows/lint.yml@main
with:
eslint-config: 'config/.eslintrc.cjs'
stylelint-config: 'config/stylelint.config.cjs'
node-version: 20
eslint-status: false
stylelint-status: false
biome-status: true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16.0
lts/jod
41 changes: 41 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
"files": {
"ignoreUnknown": false,
"ignore": ["**/node_modules", "**/examples", "**/config", "**/dist"]
},
"formatter": {
"enabled": true,
"useEditorconfig": true,
"formatWithErrors": false,
"indentStyle": "tab",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 100,
"attributePosition": "auto",
"bracketSpacing": true
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": { "noForEach": "off" },
"suspicious": { "noExplicitAny": "off" }
}
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "none",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"bracketSameLine": true,
"quoteStyle": "single",
"attributePosition": "auto",
"bracketSpacing": true
}
}
}
43 changes: 0 additions & 43 deletions config/.eslintrc.cjs

This file was deleted.

12 changes: 3 additions & 9 deletions config/package.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { license, name, version, author } from '../package.json'

export const banner =
'/*!\n' +
` * @license ${license}\n` +
` * @name ${name}\n` +
` * @version ${version}\n` +
` * @copyright ${new Date().getUTCFullYear()} ${author}\n` +
' */'
import pkg from '../package.json' with { type: 'json' }
const { author, license, name, version } = pkg

export const banner = `/*!\n * @license ${license}\n * @name ${name}\n * @version ${version}\n * @copyright ${new Date().getUTCFullYear()} ${author}\n */`
export const providers = ['youtube', 'vimeo', 'dailymotion']
export const plugins = ['subtitle', 'pip', 'cast', 'airplay', 'ima', 'volume-bar', 'sticky']
27 changes: 0 additions & 27 deletions config/prettier.config.cjs

This file was deleted.

30 changes: 17 additions & 13 deletions config/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { resolve } from 'path'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import alias from '@rollup/plugin-alias'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import svg from 'rollup-plugin-svg'
import postcss from 'rollup-plugin-postcss'
import alias from '@rollup/plugin-alias'
import { terser } from 'rollup-plugin-terser'
import { banner, providers, plugins } from './package'
import svg from 'rollup-plugin-svg'
import terser from '@rollup/plugin-terser'
import { banner, plugins, providers } from './package.js'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const isProduction = process.env.ENV === 'production'
const outputDirectory = resolve(__dirname, '../dist')
const outputDirectory = path.resolve(__dirname, '../dist')

const createConfig = ({ input, outputFile }) => {
return {
Expand All @@ -28,17 +32,17 @@ const createConfig = ({ input, outputFile }) => {
svg(),
postcss({
config: {
path: resolve(__dirname, 'postcss.config.cjs')
path: path.resolve(__dirname, 'postcss.config.cjs')
},
extract: true,
minimize: isProduction
}),
alias({
entries: [
{ find: 'shared', replacement: resolve('src/shared') },
{ find: 'components', replacement: resolve('src/components') },
{ find: 'providers', replacement: resolve('src/providers') },
{ find: 'plugins', replacement: resolve('src/plugins') }
{ find: 'shared', replacement: path.resolve('src/shared') },
{ find: 'components', replacement: path.resolve('src/components') },
{ find: 'providers', replacement: path.resolve('src/providers') },
{ find: 'plugins', replacement: path.resolve('src/plugins') }
]
}),
...(isProduction ? [terser()] : [])
Expand All @@ -60,7 +64,7 @@ export default [
})
),
createConfig({
input: `./src/core/vlite.ts`,
outputFile: `vlite.js`
input: './src/core/vlite.ts',
outputFile: 'vlite.js'
})
]
21 changes: 0 additions & 21 deletions config/stylelint.config.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion examples/audio/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../dist/vlite.css'
import '../../dist/plugins/volume-bar.css'
import Vlitejs from '../../dist/vlite.js'
import VlitejsVolumeBar from '../../dist/plugins/volume-bar.js'
import Vlitejs from '../../dist/vlite.js'

Vlitejs.registerPlugin('volume-bar', VlitejsVolumeBar)

Expand Down
4 changes: 2 additions & 2 deletions examples/dailymotion/config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '../../dist/vlite.css'
import '../../dist/plugins/volume-bar.css'
import Vlitejs from '../../dist/vlite.js'
import VlitejsDailymotion from '../../dist/providers/dailymotion.js'
import VlitejsVolumeBar from '../../dist/plugins/volume-bar.js'
import VlitejsDailymotion from '../../dist/providers/dailymotion.js'
import Vlitejs from '../../dist/vlite.js'

Vlitejs.registerProvider('dailymotion', VlitejsDailymotion, {
playerId: 'x9scg'
Expand Down
4 changes: 2 additions & 2 deletions examples/html5-hls/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '../../dist/vlite.css'
import Vlitejs from '../../dist/vlite.js'
import VlitejsPip from '../../dist/plugins/pip.js'
import Vlitejs from '../../dist/vlite.js'

Vlitejs.registerPlugin('pip', VlitejsPip)

Expand All @@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => {
autoHide: true
},
plugins: ['pip'],
onReady: function (player) {
onReady: (player) => {
console.log(player)
}
})
Expand Down
4 changes: 2 additions & 2 deletions examples/html5-ima/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../dist/vlite.css'
import '../../dist/plugins/ima.css'
import Vlitejs from '../../dist/vlite.js'
import VlitejsIma from '../../dist/plugins/ima.js'
import Vlitejs from '../../dist/vlite.js'

Vlitejs.registerPlugin('ima', VlitejsIma, {
adTagUrl:
Expand Down Expand Up @@ -29,7 +29,7 @@ const vlite = new Vlitejs('#player', {
autoHide: true
},
plugins: ['ima'],
onReady: function (player) {
onReady: (player) => {
console.log(player)

player.on('adsmanager', (e) => console.log('adsmanager', e.detail))
Expand Down
4 changes: 2 additions & 2 deletions examples/html5-sticky/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../dist/vlite.css'
import '../../dist/plugins/sticky.css'
import Vlitejs from '../../dist/vlite.js'
import VlitejsSticky from '../../dist/plugins/sticky.js'
import Vlitejs from '../../dist/vlite.js'

Vlitejs.registerPlugin('sticky', VlitejsSticky, {
mode: 'instant',
Expand All @@ -28,7 +28,7 @@ const vlite = new Vlitejs('#player', {
autoHide: true
},
plugins: ['sticky'],
onReady: function (player) {
onReady: (player) => {
console.log(player)

player.on('entersticky', () => console.log('entersticky'))
Expand Down
10 changes: 5 additions & 5 deletions examples/html5/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import '../../dist/plugins/pip.css'
import '../../dist/plugins/cast.css'
import '../../dist/plugins/airplay.css'
import '../../dist/plugins/volume-bar.css'
import Vlitejs from '../../dist/vlite.js'
import VlitejsSubtitle from '../../dist/plugins/subtitle.js'
import VlitejsPip from '../../dist/plugins/pip.js'
import VlitejsCast from '../../dist/plugins/cast.js'
import VlitejsAirplay from '../../dist/plugins/airplay.js'
import VlitejsCast from '../../dist/plugins/cast.js'
import VlitejsPip from '../../dist/plugins/pip.js'
import VlitejsSubtitle from '../../dist/plugins/subtitle.js'
import VlitejsVolumeBar from '../../dist/plugins/volume-bar.js'
import Vlitejs from '../../dist/vlite.js'

Vlitejs.registerPlugin('subtitle', VlitejsSubtitle)
Vlitejs.registerPlugin('pip', VlitejsPip)
Expand Down Expand Up @@ -43,7 +43,7 @@ const vlite = new Vlitejs('#player', {
autoHide: true
},
plugins: ['subtitle', 'pip', 'cast', 'airplay', 'volume-bar'],
onReady: function (player) {
onReady: (player) => {
console.log(player)

player.on('play', () => console.log('play'))
Expand Down
4 changes: 2 additions & 2 deletions examples/vimeo/config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '../../dist/vlite.css'
import '../../dist/plugins/volume-bar.css'
import Vlitejs from '../../dist/vlite.js'
import VlitejsVimeo from '../../dist/providers/vimeo.js'
import VlitejsVolumeBar from '../../dist/plugins/volume-bar.js'
import VlitejsVimeo from '../../dist/providers/vimeo.js'
import Vlitejs from '../../dist/vlite.js'

Vlitejs.registerProvider('vimeo', VlitejsVimeo)
Vlitejs.registerPlugin('volume-bar', VlitejsVolumeBar)
Expand Down
8 changes: 4 additions & 4 deletions examples/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fs from 'fs'
import path from 'path'
import webpack from 'webpack'
import fs from 'node:fs'
import path from 'node:path'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import TerserPlugin from 'terser-webpack-plugin'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import webpack from 'webpack'

const appDirectory = fs.realpathSync(process.cwd())
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath)
Expand Down
6 changes: 3 additions & 3 deletions examples/youtube/config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '../../dist/vlite.css'
import '../../dist/plugins/volume-bar.css'
import Vlitejs from '../../dist/vlite.js'
import VlitejsYoutube from '../../dist/providers/youtube.js'
import VlitejsVolumeBar from '../../dist/plugins/volume-bar.js'
import VlitejsYoutube from '../../dist/providers/youtube.js'
import Vlitejs from '../../dist/vlite.js'

Vlitejs.registerProvider('youtube', VlitejsYoutube)
Vlitejs.registerPlugin('volume-bar', VlitejsVolumeBar)
Expand All @@ -27,7 +27,7 @@ const vlite = new Vlitejs('#player', {
},
provider: 'youtube',
plugins: ['volume-bar'],
onReady: function (player) {
onReady: (player) => {
console.log(player)

player.on('play', () => console.log('play'))
Expand Down
Loading

0 comments on commit 8604e2d

Please sign in to comment.