Skip to content

Commit

Permalink
refactor: use biome instead of eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin committed Jul 12, 2024
1 parent 943bd58 commit c8dbf8a
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 1,001 deletions.
19 changes: 0 additions & 19 deletions .eslintrc

This file was deleted.

15 changes: 15 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noParameterAssign": "off"
}
}
}
}
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const plugin = (plugins = null, options = null, filterType = null) => {

const css = postcss(plugins)

return function (tree) {
return tree => {
const promises = []

tree.walk(node => {
Expand All @@ -23,7 +23,7 @@ const plugin = (plugins = null, options = null, filterType = null) => {
let meetsFilter = true

if (filterType) {
const typeAttr = (node.attrs && node.attrs.type) ? node.attrs.type.trim() : ''
const typeAttr = (node.attrs?.type) ? node.attrs.type.trim() : ''
const meetsTypeAttr = filterType.test(typeAttr)
const meetsStandardType = filterType.test('text/css') && (meetsTypeAttr || typeAttr === '')
const meetsOtherType = !meetsStandardType && meetsTypeAttr
Expand All @@ -43,7 +43,7 @@ const plugin = (plugins = null, options = null, filterType = null) => {
}
}

if (node.attrs && node.attrs.style) {
if (node.attrs?.style) {
promise = css.process(node.attrs.style, options)
.then(result => {
node.attrs.style = result.css
Expand Down
Loading

0 comments on commit c8dbf8a

Please sign in to comment.