From 64da2980257193bb3f661b0e223572b0b216917f Mon Sep 17 00:00:00 2001 From: Nicolai Schmid Date: Fri, 14 Feb 2020 00:40:08 +0100 Subject: [PATCH] feat(lint): add filenames eslint plugin; allow camelCase and pascal case --- config/.eslintrc.js | 7 +++++++ package.json | 1 + yarn.lock | 30 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/config/.eslintrc.js b/config/.eslintrc.js index 68c899de..79e6386b 100644 --- a/config/.eslintrc.js +++ b/config/.eslintrc.js @@ -15,9 +15,16 @@ module.exports = { 'css-modules', 'optimize-regex', 'no-secrets', + 'filenames', ], parserOptions: { sourceType: 'module', ecmaVersion: 2020, }, + rules: { + 'filenames/match-regex': 2, + 'filenames/match-regex': [2, '^[a-zA-Z]+$', true], + 'filenames/match-exported': [2, 'pascal'], + // 'filenames/no-index': 2, + }, }; diff --git a/package.json b/package.json index cd12782e..4b092efe 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "eslint-config-prettier": "^6.9.0", "eslint-plugin-css-modules": "^2.11.0", "eslint-plugin-eslint-comments": "^3.1.2", + "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-import": "^2.20.0", "eslint-plugin-json": "^2.0.1", "eslint-plugin-jsx-a11y": "^6.2.3", diff --git a/yarn.lock b/yarn.lock index e160c326..c256a4e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3150,6 +3150,16 @@ eslint-plugin-eslint-plugin@^2.1.0: resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.2.0.tgz#6cac90a8085f658e892b155dda130deac54cfa51" integrity sha512-X5+NT9a2GuwWyb3sHJdEEe6aD/30Fhi3/9XCmYHe/OSnWKUhmKOxFTfFM1AXZfJXjAoX7811bnoLI3fZr5AX5Q== +eslint-plugin-filenames@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-filenames/-/eslint-plugin-filenames-1.3.2.tgz#7094f00d7aefdd6999e3ac19f72cea058e590cf7" + integrity sha512-tqxJTiEM5a0JmRCUYQmxw23vtTxrb2+a3Q2mMOPhFxvt7ZQQJmdiuMby9B/vUAuVMghyP7oET+nIf6EO6CBd/w== + dependencies: + lodash.camelcase "4.3.0" + lodash.kebabcase "4.1.1" + lodash.snakecase "4.1.1" + lodash.upperfirst "4.3.1" + eslint-plugin-import@^2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.0.tgz#d749a7263fb6c29980def8e960d380a6aa6aecaa" @@ -5273,11 +5283,26 @@ lodash._reinterpolate@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= +lodash.camelcase@4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" + integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" integrity sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc= +lodash.kebabcase@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" + integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= + +lodash.snakecase@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d" + integrity sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40= + lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" @@ -5298,6 +5323,11 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "^3.0.0" +lodash.upperfirst@4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" + integrity sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984= + lodash@^4.14.0, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.17.5: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"