question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for shorthands in `extends` and `plugins`

See original GitHub issue

What is the problem you’re trying to solve?

Currently, we have to repeat the stylelint-config- prefix over and over in the extends field, the same for stylelint-plugin in the plugins field.

Similarly to ESLint, it would be nice to support the absence of the prefix, as in the following example:

Before:

module.exports = {
  extends: ['stylelint-config-recommended', 'stylelint-config-prettier', 'stylelint-config-rational-order', @myorg/stylelint-config]
};

After:

module.exports = {
  extends: ['recommended', 'prettier', 'rational-order', '@myorg'],
};

Not only this makes the config file more declarative, but it also encourages the community to publish their configs/plugins with the canonical name, and then this will leverage their packages (and the whole stylelint ecosystem) popularity.

What solution would you like to see?

I would like to see support for the following shorthands, adding a require.resolve chain:

extends:

  1. stylelint-config-{config}
  2. {org}/stylelint-config
  3. {config}

plugins:

  1. stylelint-plugin-{plugin}
  2. {org}/stylelint-plugin
  3. {plugin}

I have implemented this same feature in Docusaurus, and I would be glad to port it to this repository too.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jeddy3commented, Oct 24, 2022

That’s blog post is a great read.

I start doubting if this issue’s flexible shorthand feature is really necessary

It’s not, especially if we hope to migrate to a similar flat config system in the future.

As an aside, we’re close to a flat config system as an early design decision was not to implement cascading configs. I’m glad we made this decision.

From the blog post:

In hindsight, if we had thought things through a little more, we would have removed the configuration cascade at this point. Introducing extends enabled a lot of the same use cases as the cascade, and keeping both turned out to be a mess that we would spend years trying to fix. As an aside,

1reaction
ybiquitouscommented, Oct 24, 2022

When I’ve finished reading ESLint’s blog post about its new config system, I start doubting if this issue’s flexible shorthand feature is really necessary. Because it seems to me that the increased complexity of our code base will be worse than improved usability through the new shorthand support.

What do you think regarding this opinion?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shorthand Connect - Plugins - WordPress.org
This plugin provides a simple method for publishing and updating Shorthand stories directly inside of Wordpress.
Read more >
Shorthand Drupal Plugins
To use the v4 plugin in a similar way to the previous plugins you will need to enable the "Shorthand Example" in the...
Read more >
What is the difference between extends and plugins in ESLint ...
ESLint plugins allow you to add custom rules according to the needs of your project. Plugins are published as npm modules with names...
Read more >
jsx-eslint/eslint-plugin-react: React-specific linting rules for ...
If you are using the new JSX transform from React 17, extend react/jsx-runtime in your eslint config (add "plugin:react/jsx-runtime" to "extends" ) to ......
Read more >
Extending Prism
This section will help you write new language definitions, plugins and all-around Prism hacking.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found