Giter Site home page Giter Site logo

Comments (4)

yuhsianw avatar yuhsianw commented on August 24, 2024

Hi @tiwariav , thanks for reporting this. Can you please provide the reproduce steps for the issue following this example:

Repro Code

import s from './animationName.scss';

export default Foo = () => (
  <div>
    <div className={s.someAnimation}></div>
  </div>
);
@keyframes someAnimation {}

ESLint Config

{
  "plugins": ["css-modules"],
  "extends": ["plugin:css-modules/recommended"]
}

Expected Result

Expected no errors

Actual Result

Received error:

Class or exported property 'someAnimation' not found

from eslint-plugin-css-modules.

yuhsianw avatar yuhsianw commented on August 24, 2024

Template for above:

### Repro Code
```javascript
import s from './animationName.scss';

export default Foo = () => (
  <div>
    <div className={s.someAnimation}></div>
  </div>
);
```
```css
@keyframes someAnimation {}
```

### ESLint Config
```json
{
  "plugins": ["css-modules"],
  "extends": ["plugin:css-modules/recommended"]
}
```

### Expected Result
Expected no errors

### Actual Result
Received error:
```
Class or exported property 'someAnimation' not found
```

from eslint-plugin-css-modules.

tiwariav avatar tiwariav commented on August 24, 2024

Repro Code

/* eslint css-modules/no-unused-class: [2, {camelCase: true, markAsUsed:
  ['nested']
}] */
import styles from './styles.scss';

export default Foo = () => (
  <div className={styles.root}>
    <div className={styles.nested}></div>
  </div>
);
.root {
  color: green;
  & .nested {
    color: red;
  }
}

ESLint Config

{
  "plugins": ["css-modules"],
  "rules": {
    "css-modules/no-undef-class": ["warn", { "camelCase": true }],
    "css-modules/no-unused-class": ["error", { "camelCase": true }],
  }
}

Expected Result

Expected no errors

Actual Result

Received error:

TypeError: Cannot set properties of null (setting 'nested')

Can check here as well.
https://codesandbox.io/p/sandbox/brave-mopsa-ycnv8f?file=%2Fsrc%2Findex.tsx%3A6%2C1

from eslint-plugin-css-modules.

tiwariav avatar tiwariav commented on August 24, 2024

From what I have tried, its only giving error if using nested classes. Although the same works fine with previous version.

from eslint-plugin-css-modules.

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.