Skip to content

Commit 0d83e23

Browse files
authored
style(idempotency): apply standardized formatting (#1464)
1 parent 4ef4e5c commit 0d83e23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1479
-1798
lines changed

Diff for: .eslintrc.js

+42-38
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,72 @@
11
module.exports = {
2-
root: true,
32
env: {
43
browser: false,
54
es2020: true,
65
jest: true,
76
node: true,
87
},
9-
extends: [ 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended' ],
8+
ignorePatterns: ['coverage', 'lib', 'cdk.out', 'dist', 'node_modules'],
9+
extends: [
10+
'plugin:@typescript-eslint/recommended',
11+
'plugin:prettier/recommended',
12+
],
1013
parser: '@typescript-eslint/parser',
11-
plugins: ['@typescript-eslint'],
14+
plugins: ['@typescript-eslint', 'prettier'],
1215
settings: {
1316
'import/resolver': {
1417
node: {},
1518
typescript: {
16-
project: './tsconfig.es.json',
19+
project: './tsconfig.json',
1720
alwaysTryTypes: true,
1821
},
1922
},
2023
},
2124
rules: {
22-
'@typescript-eslint/ban-ts-ignore': ['off'],
23-
'@typescript-eslint/camelcase': ['off'],
24-
'@typescript-eslint/explicit-function-return-type': [ 'error', { allowExpressions: true } ],
25-
'@typescript-eslint/explicit-member-accessibility': 'error',
26-
'@typescript-eslint/indent': [ 'error', 2, { SwitchCase: 1 } ],
27-
'@typescript-eslint/interface-name-prefix': ['off'],
28-
'@typescript-eslint/member-delimiter-style': [ 'error', { multiline: { delimiter: 'none' } } ],
25+
'@typescript-eslint/explicit-function-return-type': [
26+
'error',
27+
{ allowExpressions: true },
28+
], // Enforce return type definitions for functions
29+
'@typescript-eslint/explicit-member-accessibility': 'error', // Enforce explicit accessibility modifiers on class properties and methods (public, private, protected)
2930
'@typescript-eslint/member-ordering': [
31+
// Standardize the order of class members
3032
'error',
3133
{
3234
default: {
3335
memberTypes: [
3436
'signature',
35-
'public-field', // = ["public-static-field", "public-instance-field"]
36-
'protected-field', // = ["protected-static-field", "protected-instance-field"]
37-
'private-field', // = ["private-static-field", "private-instance-field"]
37+
'public-field',
38+
'protected-field',
39+
'private-field',
3840
'constructor',
39-
'public-method', // = ["public-static-method", "public-instance-method"]
40-
'protected-method', // = ["protected-static-method", "protected-instance-method"]
41-
'private-method', // = ["private-static-method", "private-instance-method"]
41+
'public-method',
42+
'protected-method',
43+
'private-method',
4244
],
4345
order: 'alphabetically',
4446
},
4547
},
4648
],
47-
'@typescript-eslint/no-explicit-any': 'error',
48-
'@typescript-eslint/no-inferrable-types': ['off'],
49-
'@typescript-eslint/no-unused-vars': [ 'error', { argsIgnorePattern: '^_' } ],
50-
'@typescript-eslint/no-use-before-define': ['off'],
51-
'@typescript-eslint/semi': [ 'error', 'always' ],
52-
'array-bracket-spacing': [ 'error', 'always', { singleValue: false } ],
53-
'arrow-body-style': [ 'error', 'as-needed' ],
54-
'computed-property-spacing': [ 'error', 'never' ],
55-
'func-style': [ 'warn', 'expression' ],
56-
indent: [ 'error', 2, { SwitchCase: 1 } ],
57-
'keyword-spacing': 'error',
58-
'newline-before-return': 2,
59-
'no-console': 0,
60-
'no-multi-spaces': [ 'error', { ignoreEOLComments: false } ],
61-
'no-multiple-empty-lines': [ 'error', { max: 1, maxBOF: 0 } ],
62-
'no-throw-literal': 'error',
63-
'object-curly-spacing': [ 'error', 'always' ],
64-
'prefer-arrow-callback': 'error',
65-
quotes: [ 'error', 'single', { allowTemplateLiterals: true } ],
66-
semi: [ 'error', 'always' ]
67-
}
49+
'@typescript-eslint/no-explicit-any': 'error', // Disallow usage of the any type
50+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // Disallow unused variables, except for variables starting with an underscore
51+
'@typescript-eslint/no-use-before-define': ['off'], // Check if this rule is needed
52+
'no-unused-vars': 'off', // Disable eslint core rule, since it's replaced by @typescript-eslint/no-unused-vars
53+
// Rules from eslint core https://eslint.org/docs/latest/rules/
54+
'array-bracket-spacing': ['error', 'never'], // Disallow spaces inside of array brackets
55+
'computed-property-spacing': ['error', 'never'], // Disallow spaces inside of computed properties
56+
'func-style': ['warn', 'expression'], // Enforce function expressions instead of function declarations
57+
'keyword-spacing': 'error', // Enforce spaces after keywords and before parenthesis, e.g. if (condition) instead of if(condition)
58+
'padding-line-between-statements': [
59+
// Require an empty line before return statements
60+
'error',
61+
{ blankLine: 'always', prev: '*', next: 'return' },
62+
],
63+
'no-console': 0, // Allow console.log statements
64+
'no-multi-spaces': ['error', { ignoreEOLComments: false }], // Disallow multiple spaces except for comments
65+
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }], // Enforce no empty line at the beginning & end of files and max 1 empty line between consecutive statements
66+
'no-throw-literal': 'error', // Disallow throwing literals as exceptions, e.g. throw 'error' instead of throw new Error('error')
67+
'object-curly-spacing': ['error', 'always'], // Enforce spaces inside of curly braces in objects
68+
'prefer-arrow-callback': 'error', // Enforce arrow functions instead of anonymous functions for callbacks
69+
quotes: ['error', 'single', { allowTemplateLiterals: true }], // Enforce single quotes except for template strings
70+
semi: ['error', 'always'], // Require semicolons instead of ASI (automatic semicolon insertion) at the end of statements
71+
},
6872
};

Diff for: docs/snippets/.eslintrc.js

-71
This file was deleted.

Diff for: examples/cdk/.eslintrc.js

-72
This file was deleted.

Diff for: examples/sam/.eslintrc.js

-72
This file was deleted.

0 commit comments

Comments
 (0)