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

Add ignore option to the filename-case rule #431

Conversation

alexander-akait
Copy link

fixes #395

@fisker
Copy link
Collaborator

fisker commented Nov 8, 2019

I think you we need regexp support,

for examples MyClass.web.js, MyClass.android.js from #395 we can use /*\.(web|android)\.js/, is regexp allowed in eslint config?

docs/rules/filename-case.md Outdated Show resolved Hide resolved
rules/filename-case.js Outdated Show resolved Hide resolved
@alexander-akait alexander-akait force-pushed the feat-ignore-option-for-the-filename-case-rule branch from a172098 to 2c2889a Compare November 11, 2019 12:15
@alexander-akait
Copy link
Author

@fisker done

@alexander-akait
Copy link
Author

strange problem with integration tests, what tips will be?

@fisker
Copy link
Collaborator

fisker commented Nov 12, 2019

something in got codebase can't parse, should be ?.

@sindresorhus sindresorhus changed the title feat: new ignore option for the filename-case rule Add ignore option for the filename-case rule Nov 12, 2019
@fisker
Copy link
Collaborator

fisker commented Nov 12, 2019

@sindresorhus I'm updating dependencies

testCase('src/foo/{foo_bar}.js', 'snakeCase')
testCase('src/foo/{foo_bar}.js', 'snakeCase'),
testCaseWithOptions(undefined, undefined, [
{case: 'kebabCase', ignore: ['FOOBAR\\.js']}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should allow specifying regex literals. Most people use JS configs, so it's nicer to also be able to specify literals.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sindresorhus just allow use /foobar\.js/ as regexp, right? When i use string notation foobar\\.js it is also regexp?

Copy link
Owner

@sindresorhus sindresorhus Nov 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow both both regex literal and regex in a string.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is regex in a string a good idea? maybe confusing people

docs/rules/filename-case.md Show resolved Hide resolved
@fisker fisker force-pushed the feat-ignore-option-for-the-filename-case-rule branch from 4e61bba to 55c617c Compare November 12, 2019 09:10
@alexander-akait
Copy link
Author

@sindresorhus @fisker done

@@ -68,11 +68,19 @@ You can set the `cases` option to allow multiple cases:

### ignore

Type: `RegExp[]`\
Type: `Array<string | RegExp>`\
Default: `[]`

Filenames to ignore.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explicitly say that if a string is given, it's interpreted as a regex inside a string.

@fisker
Copy link
Collaborator

fisker commented Nov 13, 2019

so, to ignore [id].js . I have to pass ^\[id\]\.js$ ^\\[id\\]\\.js$ right?

@sindresorhus
Copy link
Owner

Correct. It might be worth adding a tip about that to the docs, as a lot of user miss how to correctly escape regexes.

@alexander-akait
Copy link
Author

@sindresorhus done, English is not my native so I can make a mistake somewhere 😄

docs/rules/filename-case.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@fisker fisker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels hard to use, but LGTM

@sindresorhus sindresorhus changed the title Add ignore option for the filename-case rule Add ignore option to the filename-case rule Nov 14, 2019
@sindresorhus sindresorhus merged commit 1bc47a0 into sindresorhus:master Nov 14, 2019
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 this pull request may close these issues.

allow using lower suffix for pascalCase in filename-case rule
3 participants