Comments (7)
Yes we are using SonarQube, I'll try to push them to update the version!
thanks!
from eslint-plugin-sonarjs.
Thanks for reporting this, indeed looks like a bug in the rule.
from eslint-plugin-sonarjs.
Closing the issue, after internal investigation seems was added explicitly as an exception not to report on styled components:
from eslint-plugin-sonarjs.
Hello,
I still get an error for styled components if I use it like this:
export const ContainerRail = styled.div`
padding-top: 20px;
position: sticky;
${props => props.theme.breakpoints.small`
position: fixed;
`}
`;
Is this the correct issue where to write? or should I open a new one?
Thanks!
from eslint-plugin-sonarjs.
Hi @ilgianfraAccedo,
cannot reproduce it, that code does not report an issue for me. Are you using latest version?
from eslint-plugin-sonarjs.
It's a company tool so I actually don't control that but I can see this:
Developer EditionVersion 8.9.7 (build 52159)
The breakpoint file is:
import { css } from 'styled-components';
import { RESPONSIVE_BREAKPOINTS } from '../constants';
// Iterate through the sizes and create a media template
export const breakpoints = Object.keys(RESPONSIVE_BREAKPOINTS).reduce((acc, label) => {
acc[label] = (...args) => css`
@media (${label === 'largeDesktop' ? 'min-width' : 'max-width'}: ${RESPONSIVE_BREAKPOINTS[label]}px) {
${css(...args)}
}
`;
return acc;
}, {});
It gives me this error Refactor this code to not use nested template literals.
all the times I use a breakpoint inside a styled component
from eslint-plugin-sonarjs.
Ok, so you are using SonarQube right? 8.9 LTS was released in 2021, and this exception for styled components was added in March 2022. You would need to update to latest LTS to have this up to date (9.9)
from eslint-plugin-sonarjs.
Related Issues (20)
- `no-nested-switch` false-positive with lambda HOT 1
- Fix FP S1764 (`no-identical-expressions`): using BigInts in bit shifting HOT 1
- no-duplicate-string ignoreStrings feature HOT 1
- Make the plugin work with the new eslint.config.js config format HOT 3
- S4144 (`no-identical-functions`) ignores arrow function if not part of variable declaration HOT 3
- Publish a NPM version with latest features HOT 1
- Prevent error of sonarjs/no-duplicate-string with CSS classes (Tailwind, Foundation, Boostrap...) HOT 9
- sonarjs/prefer-immediate-return not always a good practice HOT 3
- sonarjs/cognitive-complexity doesn't ignore functional components written as arrow function HOT 3
- Fix vulnerabilities prior to SQ 10.3 release
- Get every SonarJS rules enabled HOT 2
- no-extra-arguments not working with imported functions HOT 4
- Plugin version 0.21 and above requires Node 14 HOT 2
- Rule: CSS files should not be empty HOT 1
- No calling of literals HOT 4
- Working with ESLint 9 HOT 19
- `sonarjs/no-redundant-jump` should not be flagged for trailing `return;`s for a function returning `undefined` HOT 1
- Plugin available in the form of a .jar package HOT 4
- sonarjs/cognitive-complexity strange typings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-sonarjs.