From b4cf8b70ed1ff37a699c93a45e935e7bf213e0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Fl=C3=B3rez?= Date: Mon, 10 Jan 2022 19:17:26 -0500 Subject: [PATCH] fix(deps): add filename eslint plugin --- filenames.js | 18 ++++++++++++++++++ package.json | 1 + samples/.eslintrc.js | 8 +++++++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 filenames.js diff --git a/filenames.js b/filenames.js new file mode 100644 index 0000000..35e47ab --- /dev/null +++ b/filenames.js @@ -0,0 +1,18 @@ +module.exports = { + plugins: ['filenames'], + + rules: { + 'filenames/match-regex': [ + 'error', + '^\\.?[a-z-]+\\.?(config|test|queries|types)?\\.?(d)?$', + true, + ], + 'filenames/match-exported': [ + 'error', + 'kebab', + '\\.(config|test|queries|types)$', + true, + ], + 'filenames/no-index': 'off', + }, +} diff --git a/package.json b/package.json index 37aa07c..619a488 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@typescript-eslint/parser": "^5.3.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-import": "^2.24.2", "eslint-plugin-jest": "^24.4.0", "eslint-plugin-jest-dom": "^3.9.0", diff --git a/samples/.eslintrc.js b/samples/.eslintrc.js index 2eed659..26ee31a 100644 --- a/samples/.eslintrc.js +++ b/samples/.eslintrc.js @@ -1,5 +1,11 @@ module.exports = { - extends: ['../react.js', '../jsx-a11y.js', '../index.js', '../jest.js'], + extends: [ + '../react.js', + '../jsx-a11y.js', + '../index.js', + '../jest.js', + '../filenames.js', + ], overrides: [ { files: ['**/*.ts?(x)'],