Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.1 causes crash if a .prettierrc.js file is not present #310

Closed
mattbrictson opened this issue Jul 27, 2023 · 1 comment · Fixed by #311
Closed

4.0.1 causes crash if a .prettierrc.js file is not present #310

mattbrictson opened this issue Jul 27, 2023 · 1 comment · Fixed by #311

Comments

@mattbrictson
Copy link

mattbrictson commented Jul 27, 2023

stylelint crashes with the introduction of with stylelint-prettier 4.0.1. The crash goes away if a .prettierrc.js file is created.

What version of stylelint, prettier and stylelint-prettier are you using?

prettier@3.0.0
stylelint-prettier@4.0.1
stylelint@15.10.2

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

.prettierrc (none)

.stylelintrc.js
module.exports = {
  plugins: ["stylelint-declaration-strict-value"],
  extends: [
    "stylelint-config-standard",
    "stylelint-config-recommended-scss",
    "stylelint-prettier/recommended",
  ],
  rules: {
    "alpha-value-notation": null,
    "color-function-notation": null,
    "declaration-empty-line-before": null,
    "declaration-no-important": true,
    "import-notation": null,
    "max-nesting-depth": 1,
    "no-empty-source": null,
    "no-invalid-position-at-import-rule": null,
    "property-no-unknown": [
      true,
      {
        // Allow property used for css-fonts-4 variable fonts
        ignoreProperties: ["font-named-instance"],
      },
    ],
    "scale-unlimited/declaration-strict-value": [
      "/color/",
      {
        disableFix: true,
        ignoreValues: [
          "currentcolor",
          "inherit",
          "initial",
          "transparent",
          "unset",
        ],
      },
    ],
    "scss/at-function-pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
    "scss/at-mixin-pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
    "scss/dollar-variable-pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
    "scss/no-global-function-names": null,
    "scss/no-duplicate-dollar-variables": true,
    "scss/selector-no-redundant-nesting-selector": true,
    "selector-class-pattern": [
      // classes must be in BEM form, like this:
      // my-component
      // my-component--variant
      // my-component__element
      // my-component__element--variant
      // my-component__long-element-name
      // my-component__long-element-name--variant
      "^[a-z]+(-[a-z]+)*(__[a-z]+(-[a-z]+)*)?(--[a-z]+(-[a-z]+)*)*$",
      {
        resolveNestedSelectors: true,
        message:
          "Classes must be in BEM form like `my-component__element--variant`",
      },
    ],
    "selector-max-compound-selectors": 2,
    "selector-max-id": 0,
    "selector-no-qualifying-type": true,
  },
};

What source code are you linting?

.scss files

What did you expect to happen?

I expected stylelint to run without errors.

What actually happened?

TypeError: Cannot read properties of null (reading 'plugins')
    at node_modules/stylelint-prettier/stylelint-prettier.js:59:29
    at async Promise.all (index 0)
    at async Promise.all (index 20)
    at async lintSource (node_modules/stylelint/lib/lintSource.js:110:2)
    at async node_modules/stylelint/lib/standalone.js:211:27
    at async Promise.all (index 0)
    at async standalone (node_modules/stylelint/lib/standalone.js:254:22)
@BPScott
Copy link
Member

BPScott commented Jul 28, 2023

Thanks for the report. I've shipped the fix in 4.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants