eslint-plugin-postcss-modules icon indicating copy to clipboard operation
eslint-plugin-postcss-modules copied to clipboard

I use to annotate in the less file, eslint will block and cannot be used

Open lvzegeng opened this issue 3 years ago • 2 comments

.eslintrc.js

module.exports = {
  parser: '@babel/eslint-parser',
  plugins: ['postcss-modules'],
  settings: {
    'postcss-modules': {
      // 用于确定应该为 css-module 导出解析哪些文件。任何匹配 include 但不匹配 exclude 的文件都将被解析
      include: '**/*.less',
      // 用于确定不应为 css-module 导出解析哪些文件。任何匹配 include 但不匹配 exclude 的文件都将被解析
      exclude: '**/node_modules/**/*',
    },
  },
  rules: {
    'postcss-modules/no-undef-class': 'error',
    'postcss-modules/no-unused-class': 'error',
  },
};

index.module.less

//.container {
//  padding: 40px;
//}

lvzegeng avatar Aug 19 '22 06:08 lvzegeng

I'm not sure I understand what the problem is you are running into, but, have you configured postcss to use the less syntax? See https://www.npmjs.com/package/postcss-less

bmatcuk avatar Sep 04 '22 12:09 bmatcuk

He meant that your plugin crushes on comments (// comment). It works with the natively supported by css format tho (/* comment */)

MateuszGroth avatar Jun 15 '23 11:06 MateuszGroth