Giter VIP home page Giter VIP logo

Comments (7)

ilgianfraAccedo avatar ilgianfraAccedo commented on June 1, 2024 1

Yes we are using SonarQube, I'll try to push them to update the version!

thanks!

from eslint-plugin-sonarjs.

victor-diez-sonarsource avatar victor-diez-sonarsource commented on June 1, 2024

Thanks for reporting this, indeed looks like a bug in the rule.

from eslint-plugin-sonarjs.

victor-diez-sonarsource avatar victor-diez-sonarsource commented on June 1, 2024

Closing the issue, after internal investigation seems was added explicitly as an exception not to report on styled components:

#319

from eslint-plugin-sonarjs.

ilgianfraAccedo avatar ilgianfraAccedo commented on June 1, 2024

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.

victor-diez-sonarsource avatar victor-diez-sonarsource commented on June 1, 2024

Hi @ilgianfraAccedo,

cannot reproduce it, that code does not report an issue for me. Are you using latest version?

from eslint-plugin-sonarjs.

ilgianfraAccedo avatar ilgianfraAccedo commented on June 1, 2024

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.

victor-diez-sonarsource avatar victor-diez-sonarsource commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.