Skip to content

Commit c0b5f5c

Browse files
style: more lint
1 parent 21e64e6 commit c0b5f5c

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"test:generate": "node -r sucrase/register generate.ts",
1414
"build:clean": "rimraf dist && npm run build",
1515
"build": "tsup ./src/index.ts --dts --format esm,cjs",
16-
"release": "npm run build:clean && bumpp --tag --commit --push"
16+
"release": "npm run build:clean && bumpp --tag --commit --push",
17+
"lint": "eslint src",
18+
"lint:tests": "eslint tests --ext .ts"
1719
},
1820
"repository": {
1921
"type": "git",

src/utils.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ class Step {
9595
// TODO: ERROR HANDLING
9696
// TODO: Debug utils lib
9797

98-
// let WINDI_EXPRESSION = lines[i].toString().match(/windi\`(.*?)\`/i);
99-
// if (WINDI_EXPRESSION) {
100-
// const INTERPRETED_WINDI_EXPRESSION = PROCESSOR.interpret(WINDI_EXPRESSION[1]);
101-
// }
102-
10398
const tmpContent = this.content
10499
const WINDI_MATCHES = [...tmpContent.matchAll(/windi`(.*?)`/gi)]
105100
if (WINDI_MATCHES.length < 1) return this
@@ -135,9 +130,7 @@ class Step {
135130
// TODO: ERROR HANDLING
136131
// TODO: Debug utils lib
137132

138-
139-
// FIXME: not bulletprof yet
140-
133+
// FIXME: #150 not bulletprof yet
141134
const tmpContent = this.content
142135
const ATTRIBUTIFY_CLASS_MATCHES = [...tmpContent.matchAll(/([\w+:_/-]+)=(['"])([!\w\s\n~:/\\,%#[\].$-]*?)\2/gi)]
143136
// TODO: allow prefix with ::
@@ -227,7 +220,7 @@ export class Magician {
227220
// TODO: Debug utils lib
228221

229222
let tmpContent = this.content
230-
// FIXME: needs to be refactored. shouldn't remove comments completly, just for parsing
223+
// FIXME: CodeQL CODE WARNING
231224
tmpContent = tmpContent.replace(/<!--[\s\S]*?-->/g, '')
232225
tmpContent = tmpContent.replace(/([!\w][\w:_/-]*?):\(([\w\s/-]*?)\)/gm, (_, groupOne: string, groupTwo: string) =>
233226
groupTwo
@@ -280,14 +273,9 @@ export class Magician {
280273
this.css = ''
281274
const style = tmpContent.match(/<style[^>]*?(\/|(>([\s\S]*?)<\/style))>/)?.[0]
282275
if (style) {
283-
// var global = style.match(/\<style global\>/gi);
284276
const openTag = style.match(/<style[^>]*?>/gi)?.[0] || '<style>'
277+
// FIXME: CODEQL CODE WARNING
285278
this.css = style.replace(/<\/?style[^>]*>/g, '')
286-
// if (global) {
287-
// this.stylesheets.push(this.useGlobal(new CSSParser(css, this.processor).parse()));
288-
// } else {
289-
// this.stylesheets.push(new CSSParser(css, this.processor).parse());
290-
// }
291279
tmpContent = tmpContent.replace(/<style[^>]*?(\/|(>([\s\S]*?)<\/style))>/g, `${openTag}\n</style>`)
292280
tmpContent = tmpContent.replace('<style', '<style windi:inject')
293281
} else {
@@ -355,10 +343,7 @@ export class Magician {
355343

356344

357345
const directiveSet = new Set(this.directives)
358-
// console.log(directiveSet);
359346
const INTERPRETED_DIRECTIVE = this.processor.interpret(Array.from(directiveSet).join(' ')).styleSheet
360-
361-
// console.log(this.attributifies);
362347
const startA = performance.now()
363348
const INTERPRETED_ATTRIBUTIFY = this.processor.attributify(Object.fromEntries(this.attributifies)).styleSheet
364349
const endA = performance.now()

0 commit comments

Comments
 (0)