From 97694b4ecdea584d00913de18ecb92459bd5ca34 Mon Sep 17 00:00:00 2001 From: dfs Date: Thu, 26 Aug 2021 22:11:30 +0530 Subject: [PATCH 1/6] Remove babel plugin decorators. See https://github.com/stylelint/postcss-css-in-js/pull/161 --- extract.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract.js b/extract.js index d7ab264..be8b401 100644 --- a/extract.js +++ b/extract.js @@ -94,7 +94,7 @@ const plugins = [ 'jsx', 'typescript', 'objectRestSpread', - ['decorators', { decoratorsBeforeExport: false }], + // ['decorators', { decoratorsBeforeExport: false }], 'classProperties', 'exportExtensions', 'asyncGenerators', From 7f971d52fe75dbbc26fb2e927381786047259894 Mon Sep 17 00:00:00 2001 From: dfs Date: Thu, 26 Aug 2021 22:29:34 +0530 Subject: [PATCH 2/6] Disable typescript plugin as well --- extract.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract.js b/extract.js index be8b401..dbf0e76 100644 --- a/extract.js +++ b/extract.js @@ -92,7 +92,7 @@ const supports = { const plugins = [ 'jsx', - 'typescript', + // 'typescript', 'objectRestSpread', // ['decorators', { decoratorsBeforeExport: false }], 'classProperties', From f13c3632fa6dee10796643938d9fa00f7dd8803c Mon Sep 17 00:00:00 2001 From: dfs Date: Thu, 26 Aug 2021 23:02:20 +0530 Subject: [PATCH 3/6] Disable css in js frameworks except styled --- extract.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/extract.js b/extract.js index dbf0e76..4b0f69c 100644 --- a/extract.js +++ b/extract.js @@ -14,7 +14,7 @@ const supports = { styled: true, // import { style } from "typestyle"; - style: true, + // style: true, // import { StyleSheet, css } from 'aphrodite'; // import styled, { css } from 'astroturf'; @@ -26,68 +26,68 @@ const supports = { // import { StyleSheet, css } from 'aphrodite'; // import { AppRegistry, StyleSheet, Text, View } from 'react-native'; - StyleSheet: isStyleSheetCreate, + // StyleSheet: isStyleSheetCreate, // import styled, { css } from 'astroturf'; - astroturf: true, + // astroturf: true, // require('csjs')`css`; - csjs: true, + // csjs: true, // require('cssobj')({color: 'red'}) - cssobj: true, + // cssobj: true, // require('electron-css')({color: 'red'}) - 'electron-css': true, + // 'electron-css': true, // import styled from "react-emotion"; - 'react-emotion': true, + // 'react-emotion': true, // import styled from 'vue-emotion'; // Also see: // - https://github.com/stylelint/stylelint/issues/4247 // - https://github.com/gucong3000/postcss-jsx/issues/63 // - https://github.com/stylelint/postcss-css-in-js/issues/22 - 'vue-emotion': true, + // 'vue-emotion': true, // import styled from 'preact-emotion' - 'preact-emotion': true, + // 'preact-emotion': true, // https://github.com/streamich/freestyler - freestyler: true, + // freestyler: true, // https://github.com/paypal/glamorous - glamorous: true, + // glamorous: true, // https://github.com/irom-io/i-css // "i-css": (i, nameSpace) => nameSpace[i + 1] === "addStyles" && nameSpace[i + 2] === "wrapper", // https://github.com/j2css/j2c - j2c: expectAdjacentSibling(['inline', 'sheet']), + // j2c: expectAdjacentSibling(['inline', 'sheet']), // var styles = StyleSheet.create({color: 'red'}) - 'react-inline': isStyleSheetCreate, - 'react-style': isStyleSheetCreate, + // 'react-inline': isStyleSheetCreate, + // 'react-style': isStyleSheetCreate, // import reactCSS from 'reactcss' - reactcss: true, + // reactcss: true, // const StyledButton = injectSheet(styles)(Button) - 'react-jss': true, + // 'react-jss': true, // import styled from 'styled-components'; 'styled-components': true, // import {withStyle} from "styletron-react"; - 'styletron-react': expectAdjacentSibling(['withStyle']), + // 'styletron-react': expectAdjacentSibling(['withStyle']), styling: true, // const rule = superstyle({ color: 'blue' }) - superstyle: true, + // superstyle: true, // import { makeStyles } from '@material-ui/styles' - styles: expectAdjacentSibling(['makeStyles']), + // styles: expectAdjacentSibling(['makeStyles']), }; const plugins = [ From 1419d23fbe714d6aaa27b87ed6a44500ca49e7f9 Mon Sep 17 00:00:00 2001 From: dfs Date: Fri, 27 Aug 2021 03:18:31 +0530 Subject: [PATCH 4/6] Disable looking inside style tags --- extract.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extract.js b/extract.js index 4b0f69c..b2a455d 100644 --- a/extract.js +++ b/extract.js @@ -306,11 +306,11 @@ function literalParser(source, opts, styles) { setSpecifier(specifier.local, nameSpace); }); }, - JSXAttribute: (path) => { - if (/^(?:css|style)$/.test(path.node.name.name)) { - addObjectJob(path.get('value.expression')); - } - }, + // JSXAttribute: (path) => { + // if (/^(?:css|style)$/.test(path.node.name.name)) { + // addObjectJob(path.get('value.expression')); + // } + // }, VariableDeclarator: (path) => { variableDeclarator.set(path.node.id, path.node.init ? [path.get('init')] : []); }, From 20b084e63e1fff5975a6345768c63e030430752e Mon Sep 17 00:00:00 2001 From: dfs Date: Mon, 13 Sep 2021 15:55:33 +0530 Subject: [PATCH 5/6] Fail loudly when CSS AST cannot be parsed --- extract.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/extract.js b/extract.js index b2a455d..268be29 100644 --- a/extract.js +++ b/extract.js @@ -157,12 +157,8 @@ function loadBabelOpts(opts) { function literalParser(source, opts, styles) { let ast; - try { - ast = parse(source, loadBabelOpts(opts)); - } catch (ex) { - // console.error(ex); - return styles || []; - } + // Fail loudly when AST cannot be parsed for some reason + ast = parse(source, loadBabelOpts(opts)); const specifiers = new Map(); const variableDeclarator = new Map(); From e2965a504a08905dc2b6b32052f73bb8b881e7df Mon Sep 17 00:00:00 2001 From: Shubham Kanodia Date: Mon, 13 Sep 2021 16:38:06 +0530 Subject: [PATCH 6/6] Remove postinstall hook --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index f862d98..792bf0e 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ ], "scripts": { "format": "prettier . --write", - "postinstall": "is-ci || husky install", "lint": "npm-run-all --parallel lint:*", "lint:formatting": "prettier . --check", "lint:js": "eslint . --cache --max-warnings=0",