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

Support folders in `require-meta-docs-url` rule

Open constgen opened this issue 5 years ago • 0 comments

If there is a folder that contains a rule index JS file and other util modules the pattern will require a wrong documentation

Let's say I have a rule in src/rules/my-cool-rule/index.js. Some other rule may be src/rules/my-other-rule.js

The current behavior:

// eslint eslint-plugin/require-meta-docs-url: ["error", {"pattern": "src/rules/{{name}}.md"}] 
module.exports = {
  meta: {
    docs: {
      url: "src/rules/my-cool-rule/index.md"
    }
  }
};
module.exports = {
  meta: {
    docs: {
      url: "src/rules/my-other-rule.md"
    }
  }
};

The expected behavior:

// eslint eslint-plugin/require-meta-docs-url: ["error", {"pattern": "src/rules/{{name}}.md"}] 
module.exports = {
  meta: {
    docs: {
      url: "src/rules/my-cool-rule.md"
    }
  }
};
module.exports = {
  meta: {
    docs: {
      url: "src/rules/my-other-rule.md"
    }
  }
};

The rule should consider this case (index.js) and use a folder name

constgen avatar Nov 07 '19 10:11 constgen