Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Add case insensitive option to export name rule #430

Closed
erictuvesson opened this issue Jun 1, 2018 · 3 comments · Fixed by #529
Closed

Add case insensitive option to export name rule #430

erictuvesson opened this issue Jun 1, 2018 · 3 comments · Fixed by #529
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Rule Feature Adding a feature to an existing rule.
Milestone

Comments

@erictuvesson
Copy link

I would like to still have this rule enabled, but I want the code style to be the same across our project.

It would be nice if there was an option to support tableize too. So the filename can be my_class.ts and the class name MyClass.

@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Jul 5, 2018

case insensitive option

Huh, I would think the rule should only be case insensitive 😕. +1. Otherwise how would it work when a repo initialized on a case sensitive file system, then ported to a file system that is case insensitive? We probably should not get in the game of encouraging OS-specific patterns.

tableize

+1 to an option added to give it a whitelist of characters it can safely ignore. In your case, that looks like _? I'll file a separate issue so we can track that separately from the case insensitivity.

-1 to the pluralization logic in tableize. Pluralizing words is a difficult task and generally relies on having a package with much specialized logic large lists of special cases. Let's not take a dependency on that.

@JoshuaKGoldberg JoshuaKGoldberg added Status: Accepting PRs Good First Issue 🙌 Howdy, neighbor! Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Type: Rule Feature Adding a feature to an existing rule. labels Jul 5, 2018
@roblourens
Copy link
Member

roblourens commented Oct 8, 2018

How would you like this option to work with the existing args that the rule takes?

Since version 1.0, this rule takes a list of regular expressions as a parameter. Any export name matching that regular expression will be ignored. For example, to allow an exported name like myChartOptions, then configure the rule like this: "export-name": [true, "myChartOptions"]

Change it to allow something like this?

{
  "export-name": [true, {
    "allow": ["myChartOptions"],
    "ignore-case": true
  }]
}

@JoshuaKGoldberg
Copy link

@roblourens that looks like a good path forward! If the "legacy" form of string[] regular expressions is passed, we can convert it to the "allow" list.

roblourens added a commit to roblourens/tslint-microsoft-contrib that referenced this issue Oct 8, 2018
roblourens added a commit to roblourens/tslint-microsoft-contrib that referenced this issue Oct 8, 2018
JoshuaKGoldberg pushed a commit that referenced this issue Oct 8, 2018
* Fix #430 - add an 'ignore-case' option to export-name

* Add test for previous "exceptions" options format, remove getExceptions mock and use real options

* README edits for export-name #430

* Fix getIgnoreCase signature and bad copied code
@JoshuaKGoldberg JoshuaKGoldberg added this to the 6.0.0-beta0 milestone Nov 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Rule Feature Adding a feature to an existing rule.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants