Skip to content

Commit

Permalink
Merge pull request #579 from github/legacy-filenames
Browse files Browse the repository at this point in the history
Go back to legacy eslint-filenames-plugin for <v9
  • Loading branch information
gracepark authored Nov 26, 2024
2 parents 97908fc + 020bf50 commit 7c07c17
Show file tree
Hide file tree
Showing 7 changed files with 3,537 additions and 8 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export default [
]
```

> [!NOTE]
> If you configured the `filenames/match-regex` rule, please note we have adapted the match regex rule into `eslint-plugin-github` as the original `eslint-filenames-plugin` is no longer maintained and needed an ESLint v9 update. Please update the name to `github/filenames-match-regex` and keep the same configuration. For e.g.:
>
> `'github/filenames-match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$']`
The available configs are:

- `internal`
Expand Down Expand Up @@ -120,7 +125,7 @@ This config will be interpreted in the following way:
| [async-currenttarget](docs/rules/async-currenttarget.md) | disallow `event.currentTarget` calls inside of async functions | 🔍 | | |
| [async-preventdefault](docs/rules/async-preventdefault.md) | disallow `event.preventDefault` calls inside of async functions | 🔍 | | |
| [authenticity-token](docs/rules/authenticity-token.md) | disallow usage of CSRF tokens in JavaScript | 🔐 | | |
| [filenames-match-regex](docs/rules/filenames-match-regex.md) | ensure filenames match a regex naming convention | | | |
| [filenames-match-regex](docs/rules/filenames-match-regex.md) | ensure filenames match a regex naming convention | | | |
| [get-attribute](docs/rules/get-attribute.md) | disallow wrong usage of attribute names | 🔍 | 🔧 | |
| [js-class-name](docs/rules/js-class-name.md) | enforce a naming convention for js- prefixed classes | 🔐 | | |
| [no-blur](docs/rules/no-blur.md) | disallow usage of `Element.prototype.blur()` | 🔍 | | |
Expand Down
4 changes: 1 addition & 3 deletions docs/rules/filenames-match-regex.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Ensure filenames match a regex naming convention (`github/filenames-match-regex`)

💼 This rule is enabled in the ✅ `recommended` config.

<!-- end auto-generated rule header -->

## Rule Details

Rule to ensure that filenames match a convention, with a default of camelCase.
Rule to ensure that filenames match a convention, with a default of camelCase for ESLint v9+.

👎 Examples of **incorrect** filename for this default rule:

Expand Down
4 changes: 2 additions & 2 deletions lib/configs/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
env: {
es6: true,
},
plugins: ['github', 'prettier', 'eslint-comments', 'import', 'i18n-text', 'no-only-tests'],
plugins: ['github', 'prettier', 'eslint-comments', 'import', 'filenames', 'i18n-text', 'no-only-tests'],
rules: {
'constructor-super': 'error',
'eslint-comments/disable-enable-pair': 'off',
Expand All @@ -18,7 +18,7 @@ module.exports = {
'eslint-comments/no-unused-disable': 'error',
'eslint-comments/no-unused-enable': 'error',
'eslint-comments/no-use': ['error', {allow: ['eslint', 'eslint-disable-next-line', 'eslint-env', 'globals']}],
'github/filenames-match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$'],
'filenames/match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$'],
'func-style': ['error', 'declaration', {allowArrowFunctions: true}],
'github/array-foreach': 'error',
'github/no-implicit-buggy-globals': 'error',
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@github/browserslist-config": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"aria-query": "^5.3.0",
"eslint-config-prettier": ">=8.0.0",
"eslint-plugin-escompat": "^3.11.3",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-i18n-text": "^1.0.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jsx-a11y": "^6.7.1",
Expand Down
Loading

0 comments on commit 7c07c17

Please sign in to comment.