Skip to content

Commit

Permalink
style: more lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderniebuhr committed May 23, 2021
1 parent 21e64e6 commit c0b5f5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"test:generate": "node -r sucrase/register generate.ts",
"build:clean": "rimraf dist && npm run build",
"build": "tsup ./src/index.ts --dts --format esm,cjs",
"release": "npm run build:clean && bumpp --tag --commit --push"
"release": "npm run build:clean && bumpp --tag --commit --push",
"lint": "eslint src",
"lint:tests": "eslint tests --ext .ts"
},
"repository": {
"type": "git",
Expand Down
21 changes: 3 additions & 18 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ class Step {
// TODO: ERROR HANDLING
// TODO: Debug utils lib

// let WINDI_EXPRESSION = lines[i].toString().match(/windi\`(.*?)\`/i);
// if (WINDI_EXPRESSION) {
// const INTERPRETED_WINDI_EXPRESSION = PROCESSOR.interpret(WINDI_EXPRESSION[1]);
// }

const tmpContent = this.content
const WINDI_MATCHES = [...tmpContent.matchAll(/windi`(.*?)`/gi)]
if (WINDI_MATCHES.length < 1) return this
Expand Down Expand Up @@ -135,9 +130,7 @@ class Step {
// TODO: ERROR HANDLING
// TODO: Debug utils lib


// FIXME: not bulletprof yet

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

let tmpContent = this.content
// FIXME: needs to be refactored. shouldn't remove comments completly, just for parsing
// FIXME: CodeQL CODE WARNING
tmpContent = tmpContent.replace(/<!--[\s\S]*?-->/g, '')
tmpContent = tmpContent.replace(/([!\w][\w:_/-]*?):\(([\w\s/-]*?)\)/gm, (_, groupOne: string, groupTwo: string) =>
groupTwo
Expand Down Expand Up @@ -280,14 +273,9 @@ export class Magician {
this.css = ''
const style = tmpContent.match(/<style[^>]*?(\/|(>([\s\S]*?)<\/style))>/)?.[0]
if (style) {
// var global = style.match(/\<style global\>/gi);
const openTag = style.match(/<style[^>]*?>/gi)?.[0] || '<style>'
// FIXME: CODEQL CODE WARNING
this.css = style.replace(/<\/?style[^>]*>/g, '')
// if (global) {
// this.stylesheets.push(this.useGlobal(new CSSParser(css, this.processor).parse()));
// } else {
// this.stylesheets.push(new CSSParser(css, this.processor).parse());
// }
tmpContent = tmpContent.replace(/<style[^>]*?(\/|(>([\s\S]*?)<\/style))>/g, `${openTag}\n</style>`)
tmpContent = tmpContent.replace('<style', '<style windi:inject')
} else {
Expand Down Expand Up @@ -355,10 +343,7 @@ export class Magician {


const directiveSet = new Set(this.directives)
// console.log(directiveSet);
const INTERPRETED_DIRECTIVE = this.processor.interpret(Array.from(directiveSet).join(' ')).styleSheet

// console.log(this.attributifies);
const startA = performance.now()
const INTERPRETED_ATTRIBUTIFY = this.processor.attributify(Object.fromEntries(this.attributifies)).styleSheet
const endA = performance.now()
Expand Down

0 comments on commit c0b5f5c

Please sign in to comment.