From 2fa56ea780fb75530f75c2a2a35fbcedeb6afde5 Mon Sep 17 00:00:00 2001 From: Ricky Roller Date: Wed, 4 Nov 2020 15:26:24 -0800 Subject: [PATCH 1/2] Updated package version. Replaced deprecated rules. --- .gitignore | 1 + package.json | 10 +++++----- src/index.js | 33 ++++++++++++++++++++++++++++----- 3 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c2d52b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/* diff --git a/package.json b/package.json index 59bcc4d..a87e212 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.1.0", "main": "src/index.js", "sideEffects": false, - "repository": "git@git.empdev.domo.com:CustomApps/monorepo.git", + "repository": "git@github.com:DomoApps/eslint-config.git", "scripts": { "build": "echo 'no build for eslint-config'", "prepare": "yarn run build", @@ -11,12 +11,12 @@ "test:watch": "yarn run test" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^2.6.1", - "@typescript-eslint/parser": "^2.6.1", - "eslint": "^6.1.0", + "@typescript-eslint/eslint-plugin": "^3.1.0", + "@typescript-eslint/parser": "^3.1.0", + "eslint": "*", "eslint-config-prettier": "^6.5.0", "eslint-plugin-prettier": "^3.1.1", "eslint-plugin-react": "^7.16.0", - "prettier": "^1.19.1" + "prettier": "*" } } \ No newline at end of file diff --git a/src/index.js b/src/index.js index 04444a3..6a62ee3 100644 --- a/src/index.js +++ b/src/index.js @@ -74,9 +74,34 @@ module.exports = { '@typescript-eslint/prefer-for-of': 'error', '@typescript-eslint/unified-signatures': 'error', 'guard-for-in': 'error', - '@typescript-eslint/ban-types': 'error', - '@typescript-eslint/camelcase': 'error', - '@typescript-eslint/class-name-casing': 'error', + '@typescript-eslint/naming-convention': [ + 'error', + // The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this. + { + selector: 'default', + format: ['camelCase'], + }, + // Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript recommendations, we are assuming this rule would similarly apply to anything "type like", including interfaces, type aliases, and enums. + { + selector: 'typeLike', + format: ['PascalCase'], + }, + // Allow UPPER_CASE for variables to cater for 23.10 + { + selector: 'variable', + format: ['camelCase', 'UPPER_CASE', 'PascalCase'], + }, + // Allow any naming convention for properties, because (1) Airbnb does not specify any naming conventions for properties (2) The `camelcase` rule specifically disables checking properties: https://github.com/airbnb/javascript/blob/06b3ab11d9a443ff46f052dd00375e271e5146e6/packages/eslint-config-airbnb-base/rules/style.js#L24 + { + selector: 'property', + format: null, + }, + // Allow any naming convention for enum members, because Airbnb has no recommendation + { + selector: 'enumMember', + format: null, + }, + ], '@typescript-eslint/no-for-in-array': 'error', 'no-restricted-imports': ['error', 'rxjs', 'lodash'], 'no-caller': 'error', @@ -85,7 +110,6 @@ module.exports = { 'no-console': 'warn', 'no-debugger': 'warn', 'constructor-super': 'error', - 'no-shadow-restricted-names': 'error', 'no-empty': 'error', 'no-shadow': 'error', 'no-sparse-arrays': 'error', @@ -94,7 +118,6 @@ module.exports = { '@typescript-eslint/restrict-plus-operands': 'error', 'use-isnan': 'error', 'arrow-body-style': 'error', - '@typescript-eslint/interface-name-prefix': ['error', 'never'], 'new-parens': 'error', // TODO: when released, enable this rule // '@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'as' }], From e7b4521a5b5c2adbb054e2b54de6f6db0b5e57e4 Mon Sep 17 00:00:00 2001 From: Ricky Roller Date: Wed, 4 Nov 2020 15:26:56 -0800 Subject: [PATCH 2/2] v1.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a87e212..1b75897 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@domoapps/eslint-config", - "version": "1.1.0", + "version": "1.2.0", "main": "src/index.js", "sideEffects": false, "repository": "git@github.com:DomoApps/eslint-config.git",