From b1ba409d3e85c9932fde9bdf6e409d35250eebce Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Wed, 18 Oct 2023 12:48:14 -0400 Subject: [PATCH] Introduce check-file plugin --- .eslintrc.js | 14 +++++++++++++- package.json | 1 + yarn.lock | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 504dc12b44..2d0f992da2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -28,7 +28,7 @@ module.exports = { "plugin:jsdoc/recommended-typescript-error", "plugin:prettier/recommended", // Note: prettier must ALWAYS be the last extension. ], - plugins: ["@typescript-eslint", "sort-destructure-keys"], + plugins: ["@typescript-eslint", "sort-destructure-keys", "check-file"], settings: { react: { version: "detect", @@ -96,6 +96,18 @@ module.exports = { // Rules for prettier. "prettier/prettier": errorIfStrict, // Makes Prettier issues warnings rather than errors. "sort-destructure-keys/sort-destructure-keys": errorIfStrict, + "check-file/filename-naming-convention": [ + "warn", + { + "**/*.graphql": "KEBAB_CASE", + "cypress/integration/**/*.ts": "SNAKE_CASE", + "scripts/**/*.{js,ts}": "KEBAB_CASE", + "src/**/*.{js,ts}": "CAMEL_CASE", + }, + { + ignoreMiddleExtensions: true, + }, + ], }, overrides: [ // For React Typescript files in src. diff --git a/package.json b/package.json index a147f07ff5..be75845964 100644 --- a/package.json +++ b/package.json @@ -178,6 +178,7 @@ "eslint": "8.19.0", "eslint-config-airbnb": "19.0.4", "eslint-config-prettier": "8.8.0", + "eslint-plugin-check-file": "2.6.2", "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-import": "2.26.0", "eslint-plugin-jest": "27.2.1", diff --git a/yarn.lock b/yarn.lock index 0373265c0c..ae93445f99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8976,6 +8976,14 @@ eslint-module-utils@^2.7.3: dependencies: debug "^3.2.7" +eslint-plugin-check-file@2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-check-file/-/eslint-plugin-check-file-2.6.2.tgz#2e60d567ce7d087727d19c7e7b5b9def1e5b693e" + integrity sha512-z3Rur4JjOdNH0fia1IH7JQseo9NLuFVtw9j8P6z2c5XmXWemH7/qGpmMB8XbOt9bJBNpmPlNAGJty9b3EervPw== + dependencies: + is-glob "^4.0.3" + micromatch "^4.0.5" + eslint-plugin-cypress@^2.12.1: version "2.14.0" resolved "https://registry.yarnpkg.com/eslint-plugin-cypress/-/eslint-plugin-cypress-2.14.0.tgz#c65e1f592680dd25bbd00c86194ee85fecf59bd7"