Skip to content

Support for "message" with "patterns" in no-restricted-imports #11843

Closed
@mikeplis

Description

@mikeplis

Creating a new request for a closed issue, as suggested here.

What rule do you want to change? no-restricted-imports

Does this change cause the rule to produce more or fewer warnings? Neither

How will the change be implemented? (New option, new default behavior, etc.)? Allow a new format for an existing option

Please provide some example code that this change will affect:

// I can currently customize the error message for restricted path imports like this
import * as moment from 'moment';
// But I can't customize the error message for restricted pattern imports like this
import { Button } from '../../framework/buttons';

What I'd like to do in my ESLint config:

{
  "rules": {
    "no-restricted-imports": ["error", {
      "paths": [{"name": "moment", "message": "Don't import moment"}],
      "patterns": [{"name": "**/framework/*", "message": "Only import from the root of /framework"}]
    }]
  }
}

What does the rule currently do for this code? I can't customize the error message for the restricted pattern import

What will the rule do after it's changed? It should allow me to customize the error message for the restricted pattern import

Are you willing to submit a pull request to implement this change? Sure, though I'd like to get some clarity on how difficult the "large option schema change" mentioned here would be.

Activity

added
enhancementThis change enhances an existing feature of ESLint
ruleRelates to ESLint's core rules
triageAn ESLint team member will look at this issue soon
on Jun 15, 2019
added
evaluatingThe team will evaluate this issue to decide whether it meets the criteria for inclusion
and removed
triageAn ESLint team member will look at this issue soon
on Jun 17, 2019
eslint-deprecated

eslint-deprecated commented on Jul 18, 2019

@eslint-deprecated

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

platinumazure

platinumazure commented on Jul 18, 2019

@platinumazure
Member

Okay, we've had two team members review this and be in favor of the change but I think more folks can look at this.

I'll champion.

@eslint/eslint-team Can we review this please?

kaicataldo

kaicataldo commented on Sep 29, 2019

@kaicataldo
Member

@platinumazure Are you still championing this?

martin-cech

martin-cech commented on Feb 13, 2020

@martin-cech

+1 for this to express interest :-)

51 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

    Participants

    @nzakas@ljharb@platinumazure@mikeplis@osdiab

    Issue actions

      Support for "message" with "patterns" in `no-restricted-imports` · Issue #11843 · eslint/eslint