Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updated rules based on discussion #427

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion configs/@typescript-eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ module.exports = {
"extendDefaults": true,
},
],
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "variable",
"format": ["camelCase", "PascalCase", "UPPER_CASE"],
"leadingUnderscore": "allow"
}
],
"@typescript-eslint/consistent-type-assertions": ["error"],
"@typescript-eslint/no-array-constructor": ["error"],
"@typescript-eslint/no-empty-function": ['error', { 'allow': ['arrowFunctions'] }],
Expand Down
21 changes: 3 additions & 18 deletions configs/eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ module.exports = {
"max-len": [
"error",
{
code: 120,
code: 200,
tabWidth: 2,
ignoreTemplateLiterals: true,
ignoreStrings: true,
ignoreComments: true
}
],
"comma-dangle": ["error", "never"],
"comma-dangle": ["error", "always-multiline"], // not having a trailing comma results in unnecessary git changes
"implicit-arrow-linebreak": ["off", "beside"],
camelcase: [
"off",
Expand Down Expand Up @@ -193,22 +193,7 @@ module.exports = {
allowUnboundThis: true
}
],
"prefer-destructuring": [
"error",
{
VariableDeclarator: {
array: false,
object: true
},
AssignmentExpression: {
array: true,
object: false
}
},
{
enforceForRenamedProperties: false
}
],
"prefer-destructuring": ["off"], // adds unnecessary lines and removes context from code
"prefer-numeric-literals": ["error"],
"prefer-reflect": ["off"],
"prefer-template": ["error"],
Expand Down
4 changes: 2 additions & 2 deletions configs/import/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
caseSensitive: true
}
],
"import/named": ["error"],
"import/named": ["off"], // not required for TS
"import/default": ["off"],
"import/namespace": ["off"],
"import/export": ["error"],
Expand Down Expand Up @@ -66,7 +66,7 @@ module.exports = {
}
],
"import/newline-after-import": ["error"],
"import/prefer-default-export": ["error"],
"import/prefer-default-export": ["off"], // // adds unnecessary code change requirements when updating a 1 export module to multiple export and vice versa
"import/no-restricted-paths": ["off"],
"import/max-dependencies": [
"off",
Expand Down
9 changes: 2 additions & 7 deletions configs/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,7 @@ module.exports = {
],
"react/jsx-space-before-closing": ["off", "always"],
"react/no-array-index-key": ["error"],
"react/require-default-props": [
"error",
{
forbidDefaultForRequired: true
}
],
"react/require-default-props": ["off"], // not relevant to modern React with TS functional components
"react/forbid-foreign-prop-types": [
"off",
{
Expand Down Expand Up @@ -297,7 +292,7 @@ module.exports = {
children: "never"
}
],
"react/destructuring-assignment": ["error", "always"],
"react/destructuring-assignment": ["off"], // adds unnecessary lines and removes context from code
"react/no-access-state-in-setstate": ["error"],
"react/button-has-type": [
"error",
Expand Down
6 changes: 3 additions & 3 deletions tests/validate-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ describe('Validate configs by eslint', () => {
const results = await getErrors();
const errorMessages = results[0].messages;
expect(errorMessages).toHaveLength(3);
expect(errorMessages[0].ruleId).toBe('no-multi-spaces');
expect(errorMessages[1].ruleId).toBe('no-console');
expect(errorMessages[2].ruleId).toBe('no-multiple-empty-lines');
expect(errorMessages[0].ruleId).toBe('comma-dangle');
expect(errorMessages[1].ruleId).toBe('no-multi-spaces');
expect(errorMessages[2].ruleId).toBe('no-console');
});
});
Loading