Skip to content

Commit

Permalink
Remove js compatibility report from run.js
Browse files Browse the repository at this point in the history
  • Loading branch information
replete committed Aug 18, 2024
1 parent 4647a37 commit d17378b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 40 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@
"@swc/jest": "^0.2.36",
"browser-sync": "^3.0.2",
"browserslist": "^4.23.3",
"dialog-polyfill": "^0.5.6",
"doiuse": "^6.0.2",
"eslint": "^9.9.0",
"eslint-plugin-compat": "^6.0.0",
"globals": "^15.9.0",
"jest": "^29.7.0",
"jest-extended": "^4.0.2",
Expand Down
39 changes: 1 addition & 38 deletions run.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import swc from '@swc/core'
import { transform as transformCss, browserslistToTargets, Features } from 'lightningcss'
import browserslist from 'browserslist'
import { Readable } from 'stream'
import { ESLint } from 'eslint'
import compat from 'eslint-plugin-compat'
import globals from 'globals'
import doiuse from 'doiuse/stream'
import zlib from 'zlib'
const { readFile, writeFile } = fs.promises
Expand Down Expand Up @@ -186,43 +183,10 @@ function getCompressedSizes(text) {
export async function report() {
log('report', 'Running browser compatibility reports...')
await Promise.all([
cssreport(),
jsreport()
cssreport()
])
}

export async function jsreport() {
// TODO: This doesn't work, rip it out
log('js report','Checking JS browser compatibility...')
let js = await scripts(true)
const eslint = new ESLint({
overrideConfigFile: true,
overrideConfig: {
...compat.configs['flat/recommended'],
languageOptions: {
ecmaVersion: 2018,
globals: {
...globals.browser
}
},
rules: {
'compat/compat': 'error',
...compat.configs['flat/recommended'].rules
},
settings: {
browsers: 'last 10 years'
}
}
})

const lint = await eslint.lintText(js[0])
const formatter = await eslint.loadFormatter('stylish')
const jsReport = formatter.format(lint)
if (jsReport.length === 0) {
log('js report','✅ No JS Compatibilty warnings')
} else log('js report', jsReport)
}

export async function cssreport() {
log('css report','Checking CSS browser compatibility...')
let css = await styles(true)
Expand Down Expand Up @@ -299,7 +263,6 @@ async function main() {
case 'scripts': scripts(); break
case 'build': build(); break
case 'report': report(); break
case 'jsreport': jsreport(); break
default: break
}
}
Expand Down

0 comments on commit d17378b

Please sign in to comment.