double-great / stylelint-a11y

Plugin for stylelint with a11y rules
MIT License
5 stars 1 forks source link

Bug: Could not find "@double-great/stylelint-a11y/recommended" #65

Open Archinowsk opened 7 months ago

Archinowsk commented 7 months ago

I'm trying to use the recommended config but receive following error:

Error: Could not find "@double-great/stylelint-a11y/recommended". Do you need to install the package or use the "configBasedir" option?
    at configurationError (.../node_modules/stylelint/lib/utils/configurationError.mjs:12:49)
    at getModulePath (.../node_modules/stylelint/lib/utils/getModulePath.mjs:29:9)
    at loadExtendedConfig (.../node_modules/stylelint/lib/augmentConfig.mjs:217:21)
    at extendConfig (.../node_modules/stylelint/lib/augmentConfig.mjs:185:25)
    at augmentConfigBasic (.../node_modules/stylelint/lib/augmentConfig.mjs:58:26)
    at augmentConfigFull (.../node_modules/stylelint/lib/augmentConfig.mjs:112:30)
    at Object.transform (.../node_modules/stylelint/lib/getConfigForFile.mjs:52:37)
    at search (...\node_modules\cosmiconfig\dist\Explorer.js:53:54)
    at async search (...\node_modules\cosmiconfig\dist\Explorer.js:71:28)
    at async search (...\node_modules\cosmiconfig\dist\Explorer.js:71:28)

.stylelintrc.js

module.exports = {
  extends: ["@double-great/stylelint-a11y/recommended"],
  rules: {},
};

Command to run:

npx stylelint .

Happens with NPM and Yarn.

Versions:

OS: Win11

Adding rules directly works, for example this:

module.exports = {
  plugins: ["@double-great/stylelint-a11y"],

  rules: {
    "a11y/media-prefers-reduced-motion": true,
  },
};
cylewaitforit commented 4 months ago

This seems to have initially broken in 2.0.1 when the file extension changed from recommended.js -> recommended.cjs

Changing it back to js seems to fix the config in 2.x.x versions

cylewaitforit commented 2 months ago

For @double-great/stylelint-a11y@2.0.2 we were able to get the recommended list working by using yarn to patch the package.json file to have exports.

"exports":{
  "." : "./dist/index.js",
  "./recommended": "./recommended.cjs"
},

Adding exports for @double-great/stylelint-a11y@3.0.2 got past the “could not find” error but currently getting a different error that I haven’t been able to solve yet.

TypeError: Cannot read properties of undefined (reading 'ignoreFiles')