Skip to content

Commit c03d25b

Browse files
committed
bring in filenames match regex to github
1 parent 15639d6 commit c03d25b

File tree

11 files changed

+19
-17
lines changed

11 files changed

+19
-17
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ This config will be interpreted in the following way:
120120
| [async-currenttarget](docs/rules/async-currenttarget.md) | disallow `event.currentTarget` calls inside of async functions | 🔍 | | |
121121
| [async-preventdefault](docs/rules/async-preventdefault.md) | disallow `event.preventDefault` calls inside of async functions | 🔍 | | |
122122
| [authenticity-token](docs/rules/authenticity-token.md) | disallow usage of CSRF tokens in JavaScript | 🔐 | | |
123+
| [filenames-match-regex](docs/rules/filenames-match-regex.md) | ensure filenames match a regex naming convention || | |
123124
| [get-attribute](docs/rules/get-attribute.md) | disallow wrong usage of attribute names | 🔍 | 🔧 | |
124125
| [js-class-name](docs/rules/js-class-name.md) | enforce a naming convention for js- prefixed classes | 🔐 | | |
125126
| [no-blur](docs/rules/no-blur.md) | disallow usage of `Element.prototype.blur()` | 🔍 | | |

eslint.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const globals = require('globals')
22
const eslintPlugin = require('eslint-plugin-eslint-plugin')
33
const importPlugin = require('eslint-plugin-import')
4-
const filenames = require('eslint-plugin-filenames')
54
const i18nTextPlugin = require('eslint-plugin-i18n-text')
65
const recommendedGitHub = require('./lib/configs/flat/recommended')
76
const {fixupPluginRules} = require('@eslint/compat')
@@ -23,13 +22,12 @@ module.exports = [
2322
plugins: {
2423
eslintPlugin,
2524
importPlugin,
26-
filenamesPlugin: fixupPluginRules(filenames),
2725
'i18n-text': fixupPluginRules(i18nTextPlugin),
2826
},
2927
rules: {
3028
'importPlugin/extensions': 'off',
3129
'importPlugin/no-commonjs': 'off',
32-
'filenamesPlugin/match-regex': 'off',
30+
'github/filenames-match-regex': 'off',
3331
'i18n-text/no-en': 'off',
3432
'eslint-plugin/prefer-placeholders': 'off',
3533
'eslint-plugin/test-case-shorthand-strings': 'off',

lib/configs/flat/browser.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const globals = require('globals')
22
const github = require('../../plugin')
33
const importPlugin = require('eslint-plugin-import')
44
const escompatPlugin = require('eslint-plugin-escompat')
5+
const {fixupPluginRules} = require('@eslint/compat')
56

67
module.exports = {
78
...escompatPlugin.configs['flat/recommended'],
@@ -10,7 +11,7 @@ module.exports = {
1011
...globals.browser,
1112
},
1213
},
13-
plugins: {importPlugin, escompatPlugin, github},
14+
plugins: {importPlugin, escompatPlugin, github: fixupPluginRules(github)},
1415
rules: {
1516
'escompatPlugin/no-dynamic-imports': 'off',
1617
'github/async-currenttarget': 'error',

lib/configs/flat/internal.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const github = require('../../plugin')
2+
const {fixupPluginRules} = require('@eslint/compat')
23

34
module.exports = {
4-
plugins: {github},
5+
plugins: {github: fixupPluginRules(github)},
56
rules: {
67
'github/authenticity-token': 'error',
78
'github/js-class-name': 'error',

lib/configs/flat/react.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const github = require('../../plugin')
22
const jsxA11yPlugin = require('eslint-plugin-jsx-a11y')
3+
const {fixupPluginRules} = require('@eslint/compat')
34

45
module.exports = {
56
...jsxA11yPlugin.flatConfigs.recommended,
@@ -11,7 +12,7 @@ module.exports = {
1112
},
1213
},
1314
},
14-
plugins: {github, jsxA11yPlugin},
15+
plugins: {github: fixupPluginRules(github), jsxA11yPlugin},
1516
rules: {
1617
'jsxA11yPlugin/role-supports-aria-props': 'off', // Override with github/a11y-role-supports-aria-props until https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/910 is resolved
1718
'github/a11y-aria-label-is-well-formatted': 'error',

lib/configs/flat/recommended.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const github = require('../../plugin')
33
const prettierPlugin = require('eslint-plugin-prettier')
44
const eslintComments = require('eslint-plugin-eslint-comments')
55
const importPlugin = require('eslint-plugin-import')
6-
const filenames = require('eslint-plugin-filenames')
76
const i18nTextPlugin = require('eslint-plugin-i18n-text')
87
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests')
98
const {fixupPluginRules} = require('@eslint/compat')
@@ -17,13 +16,12 @@ module.exports = {
1716
},
1817
},
1918
plugins: {
20-
filenamesPlugin: fixupPluginRules(filenames),
2119
prettierPlugin,
2220
eslintComments,
2321
importPlugin,
2422
'i18n-text': fixupPluginRules(i18nTextPlugin),
2523
noOnlyTestsPlugin,
26-
github,
24+
github: fixupPluginRules(github),
2725
},
2826
rules: {
2927
'constructor-super': 'error',
@@ -34,7 +32,7 @@ module.exports = {
3432
'eslintComments/no-unused-disable': 'error',
3533
'eslintComments/no-unused-enable': 'error',
3634
'eslintComments/no-use': ['error', {allow: ['eslint', 'eslint-disable-next-line', 'eslint-env', 'globals']}],
37-
'filenamesPlugin/match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$'],
35+
'github/filenames-match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$'],
3836
'func-style': ['error', 'declaration', {allowArrowFunctions: true}],
3937
'github/array-foreach': 'error',
4038
'github/no-implicit-buggy-globals': 'error',

lib/configs/flat/typescript.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ const eslint = require('@eslint/js')
22
const tseslint = require('typescript-eslint')
33
const escompatPlugin = require('eslint-plugin-escompat')
44
const github = require('../../plugin')
5+
const {fixupPluginRules} = require('@eslint/compat')
56

67
module.exports = tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, {
78
languageOptions: {
89
parser: tseslint.parser,
910
},
10-
plugins: {'@typescript-eslint': tseslint.plugin, escompatPlugin, github},
11+
plugins: {'@typescript-eslint': tseslint.plugin, escompatPlugin, github: fixupPluginRules(github)},
1112
rules: {
1213
camelcase: 'off',
1314
'no-unused-vars': 'off',

lib/configs/recommended.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
'eslint-comments/no-unused-disable': 'error',
1919
'eslint-comments/no-unused-enable': 'error',
2020
'eslint-comments/no-use': ['error', {allow: ['eslint', 'eslint-disable-next-line', 'eslint-env', 'globals']}],
21-
'filenames/match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$'],
21+
'github/filenames-match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$'],
2222
'func-style': ['error', 'declaration', {allowArrowFunctions: true}],
2323
'github/array-foreach': 'error',
2424
'github/no-implicit-buggy-globals': 'error',

lib/plugin.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = {
1313
'async-currenttarget': require('./rules/async-currenttarget'),
1414
'async-preventdefault': require('./rules/async-preventdefault'),
1515
'authenticity-token': require('./rules/authenticity-token'),
16+
'filenames-match-regex': require('./rules/filenames-match-regex'),
1617
'get-attribute': require('./rules/get-attribute'),
1718
'js-class-name': require('./rules/js-class-name'),
1819
'no-blur': require('./rules/no-blur'),

test-examples/flat/eslint.config.mjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import github from 'eslint-plugin-github'
22

33
export default [
4-
github.getFlatConfigs().browser,
54
github.getFlatConfigs().recommended,
6-
github.getFlatConfigs().react,
7-
...github.getFlatConfigs().typescript,
5+
// github.getFlatConfigs().recommended,
6+
// github.getFlatConfigs().react,
7+
// ...github.getFlatConfigs().typescript,
88
{
99
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
1010
ignores: ['eslint.config.mjs'],
1111
rules: {
1212
'github/array-foreach': 'error',
13-
'github/async-preventdefault': 'warn',
1413
'github/no-then': 'error',
1514
'github/no-blur': 'error',
15+
'github/async-preventdefault': 'error',
1616
},
1717
},
1818
]

test-examples/flat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@eslint/js": "^9.5.0",
1010
"@types/node": "^20.14.5",
1111
"cross-env": "^7.0.3",
12-
"eslint": "^8.57.0",
12+
"eslint": "^9.14.0",
1313
"eslint-plugin-github": "file:../..",
1414
"typescript": "^5.6.3",
1515
"typescript-eslint": "^8.12.2"

0 commit comments

Comments
 (0)