Skip to content

style(idempotency): apply standardized formatting #1464

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

Merged
merged 4 commits into from
May 12, 2023
Merged
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
80 changes: 42 additions & 38 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,72 @@
module.exports = {
root: true,
env: {
browser: false,
es2020: true,
jest: true,
node: true,
},
extends: [ 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended' ],
ignorePatterns: ['coverage', 'lib', 'cdk.out', 'dist', 'node_modules'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
plugins: ['@typescript-eslint', 'prettier'],
settings: {
'import/resolver': {
node: {},
typescript: {
project: './tsconfig.es.json',
project: './tsconfig.json',
alwaysTryTypes: true,
},
},
},
rules: {
'@typescript-eslint/ban-ts-ignore': ['off'],
'@typescript-eslint/camelcase': ['off'],
'@typescript-eslint/explicit-function-return-type': [ 'error', { allowExpressions: true } ],
'@typescript-eslint/explicit-member-accessibility': 'error',
'@typescript-eslint/indent': [ 'error', 2, { SwitchCase: 1 } ],
'@typescript-eslint/interface-name-prefix': ['off'],
'@typescript-eslint/member-delimiter-style': [ 'error', { multiline: { delimiter: 'none' } } ],
'@typescript-eslint/explicit-function-return-type': [
'error',
{ allowExpressions: true },
], // Enforce return type definitions for functions
'@typescript-eslint/explicit-member-accessibility': 'error', // Enforce explicit accessibility modifiers on class properties and methods (public, private, protected)
'@typescript-eslint/member-ordering': [
// Standardize the order of class members
'error',
{
default: {
memberTypes: [
'signature',
'public-field', // = ["public-static-field", "public-instance-field"]
'protected-field', // = ["protected-static-field", "protected-instance-field"]
'private-field', // = ["private-static-field", "private-instance-field"]
'public-field',
'protected-field',
'private-field',
'constructor',
'public-method', // = ["public-static-method", "public-instance-method"]
'protected-method', // = ["protected-static-method", "protected-instance-method"]
'private-method', // = ["private-static-method", "private-instance-method"]
'public-method',
'protected-method',
'private-method',
],
order: 'alphabetically',
},
},
],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-inferrable-types': ['off'],
'@typescript-eslint/no-unused-vars': [ 'error', { argsIgnorePattern: '^_' } ],
'@typescript-eslint/no-use-before-define': ['off'],
'@typescript-eslint/semi': [ 'error', 'always' ],
'array-bracket-spacing': [ 'error', 'always', { singleValue: false } ],
'arrow-body-style': [ 'error', 'as-needed' ],
'computed-property-spacing': [ 'error', 'never' ],
'func-style': [ 'warn', 'expression' ],
indent: [ 'error', 2, { SwitchCase: 1 } ],
'keyword-spacing': 'error',
'newline-before-return': 2,
'no-console': 0,
'no-multi-spaces': [ 'error', { ignoreEOLComments: false } ],
'no-multiple-empty-lines': [ 'error', { max: 1, maxBOF: 0 } ],
'no-throw-literal': 'error',
'object-curly-spacing': [ 'error', 'always' ],
'prefer-arrow-callback': 'error',
quotes: [ 'error', 'single', { allowTemplateLiterals: true } ],
semi: [ 'error', 'always' ]
}
'@typescript-eslint/no-explicit-any': 'error', // Disallow usage of the any type
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // Disallow unused variables, except for variables starting with an underscore
'@typescript-eslint/no-use-before-define': ['off'], // Check if this rule is needed
'no-unused-vars': 'off', // Disable eslint core rule, since it's replaced by @typescript-eslint/no-unused-vars
// Rules from eslint core https://eslint.org/docs/latest/rules/
'array-bracket-spacing': ['error', 'never'], // Disallow spaces inside of array brackets
'computed-property-spacing': ['error', 'never'], // Disallow spaces inside of computed properties
'func-style': ['warn', 'expression'], // Enforce function expressions instead of function declarations
'keyword-spacing': 'error', // Enforce spaces after keywords and before parenthesis, e.g. if (condition) instead of if(condition)
'padding-line-between-statements': [
// Require an empty line before return statements
'error',
{ blankLine: 'always', prev: '*', next: 'return' },
],
'no-console': 0, // Allow console.log statements
'no-multi-spaces': ['error', { ignoreEOLComments: false }], // Disallow multiple spaces except for comments
'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
'no-throw-literal': 'error', // Disallow throwing literals as exceptions, e.g. throw 'error' instead of throw new Error('error')
'object-curly-spacing': ['error', 'always'], // Enforce spaces inside of curly braces in objects
'prefer-arrow-callback': 'error', // Enforce arrow functions instead of anonymous functions for callbacks
quotes: ['error', 'single', { allowTemplateLiterals: true }], // Enforce single quotes except for template strings
semi: ['error', 'always'], // Require semicolons instead of ASI (automatic semicolon insertion) at the end of statements
},
};
71 changes: 0 additions & 71 deletions docs/snippets/.eslintrc.js

This file was deleted.

72 changes: 0 additions & 72 deletions examples/cdk/.eslintrc.js

This file was deleted.

72 changes: 0 additions & 72 deletions examples/sam/.eslintrc.js

This file was deleted.

Loading