Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Jun 21, 2022
1 parent 9c6631d commit 17645e4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,5 @@
"node": ">=12.22.0",
"pnpm": ">= 7.2.1"
},
"packageManager": "pnpm@7.2.1"
"packageManager": "pnpm@7.3.0"
}
2 changes: 1 addition & 1 deletion packages/next-swc/crates/styled_components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use crate::{
use serde::Deserialize;
use std::{cell::RefCell, rc::Rc};
use swc_atoms::JsWord;
use swc_common::{chain, FileName, pass::Optional};
use swc_common::{chain, pass::Optional, FileName};
use swc_ecmascript::visit::{Fold, VisitMut};

mod css;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ struct DisplayNameAndId {
impl DisplayNameAndId {
fn get_block_name(&self, p: &Path) -> String {
match p.file_stem().map(|s| s.to_string_lossy().to_string()) {
Some(file_stem) if !self.config.meaningless_file_names.contains(&file_stem) => file_stem,
_ => self.get_block_name(p.parent().expect("path only contains meaningless filenames (e.g. /index/index)?")),
Some(file_stem) if !self.config.meaningless_file_names.contains(&file_stem) => {
file_stem
}
_ => self.get_block_name(
p.parent()
.expect("path only contains meaningless filenames (e.g. /index/index)?"),
),
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/next/build/swc/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getParserOptions({ filename, jsConfig, ...rest }) {
dynamicImport: true,
decorators: enableDecorators,
// Exclude regular TypeScript files from React transformation to prevent e.g. generic parameters and angle-bracket type assertion from being interpreted as JSX tags.
[isTypeScript ? 'tsx' : 'jsx']: isTSFile ? false : true,
[isTypeScript ? 'tsx' : 'jsx']: !isTSFile,
importAssertions: true,
}
}
Expand Down Expand Up @@ -117,8 +117,8 @@ function getBaseSWCOptions({
}
}

function getStyledComponentsOptions (nextConfig, development) {
let styledComponentsOptions = nextConfig?.compiler?.styledComponents;
function getStyledComponentsOptions(nextConfig, development) {
let styledComponentsOptions = nextConfig?.compiler?.styledComponents
if (!styledComponentsOptions) {
return null
}
Expand Down
22 changes: 11 additions & 11 deletions packages/next/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,17 +429,17 @@ export interface NextConfig extends Record<string, any> {
* Enabled by default in development, disabled in production to reduce file size,
* setting this will override the default for all environments.
*/
displayName?: boolean,
topLevelImportPaths?: string[],
ssr?: boolean,
fileName?: boolean,
meaninglessFileNames?: string[],
minify?: boolean,
transpileTemplateLiterals?: boolean,
namespace?: string,
pure?: boolean,
cssProp?: boolean,
},
displayName?: boolean
topLevelImportPaths?: string[]
ssr?: boolean
fileName?: boolean
meaninglessFileNames?: string[]
minify?: boolean
transpileTemplateLiterals?: boolean
namespace?: string
pure?: boolean
cssProp?: boolean
}
emotion?:
| boolean
| {
Expand Down
6 changes: 5 additions & 1 deletion test/development/basic/styled-components/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ const Button = styled.a`
export default function Home() {
console.log('__render__')
return (
<div css={`background: black`}>
<div
css={`
background: black;
`}
>
<Button
href="https://github.com/styled-components/styled-components"
target="_blank"
Expand Down

0 comments on commit 17645e4

Please sign in to comment.