Skip to content
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
142 changes: 97 additions & 45 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,28 @@ module.exports = {
'airbnb',
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/eslint-recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/eslint-recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
],
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
env: {
es6: true,
node: true,
jest: true,
},
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
jsx: true, // Allows for the parsing of JSX
arrowFunctions: true,
modules: true,
module: true,
},
},
plugins: [
'@typescript-eslint',
'prettier',
'spellcheck',
],
plugins: ['@typescript-eslint', 'prettier', 'spellcheck'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
Expand All @@ -38,34 +34,27 @@ module.exports = {
typescript: {},
},
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
rules: {
"spellcheck/spell-checker": [1,
'spellcheck/spell-checker': [
1,
{
"comments": false,
"strings": true,
"identifiers": false,
"lang": "en_US",
"skipWords": [
"dict",
"aff",
"hunspellchecker",
"hunspell",
"utils",
"aws",
"sdk",
],
"skipIfMatch": [
"http://[^s]*",
"^[-\\w]+\/[-\\w\\.]+$" //For MIME Types
comments: false,
strings: true,
identifiers: false,
lang: 'en_US',
skipWords: ['dict', 'aff', 'hunspellchecker', 'hunspell', 'utils', 'aws', 'sdk'],
skipIfMatch: [
'http://[^s]*',
'^[-\\w]+/[-\\w\\.]+$', //For MIME Types
],
"skipWordIfMatch": [
"^foobar.*$" // words that begin with foobar will not be checked
skipWordIfMatch: [
'^foobar.*$', // words that begin with foobar will not be checked
],
"minLength": 3
}
minLength: 3,
},
],
// Existing rules
'comma-dangle': 'off', // https://eslint.org/docs/rules/comma-dangle
Expand All @@ -83,7 +72,7 @@ module.exports = {
'@typescript-eslint/no-var-requires': 'off',

// TODO Rules to enable linter pass for upgrade, fix them first
'eqeqeq': 'off',
eqeqeq: 'off',
'func-names': 'off',
'lines-between-class-members': 'off',
'max-classes-per-file': 'off',
Expand Down Expand Up @@ -112,7 +101,7 @@ module.exports = {
'prettier/prettier': 'off',

// TODO needs to be enabled when fixing valid warnings of this error
'no-constant-condition': ['error', { 'checkLoops': false }],
'no-constant-condition': ['error', { checkLoops: false }],
//'no-param-reassign': ['error', { 'props': false }],
'no-param-reassign': 'off', // https://eslint.org/docs/rules/no-param-reassign
//'no-plusplus': ['error', { 'allowForLoopAfterthoughts': true }], // https://eslint.org/docs/rules/no-plusplus
Expand All @@ -139,9 +128,9 @@ module.exports = {

// TSLint existing rules
'@typescript-eslint/class-name-casing': 'error',
'curly': 'off', // Enable later
curly: 'off', // Enable later
'guard-for-in': 'error',
'indent': 'off', // Enable later
indent: 'off', // Enable later
//'indent': ['error', 2],
'no-labels': 'error',
'no-caller': 'error',
Expand All @@ -153,7 +142,7 @@ module.exports = {
'dot-notation': 'off', // Enable later
'no-trailing-spaces': 'error',
'no-unused-expressions': 'error',
'semi': 'off', // Enable later,
semi: 'off', // Enable later,
'@typescript-eslint/typedef': 'off', // Enable later
//'@typescript-eslint/typedef': ['error', { propertyDeclaration:true, variableDeclaration: true, memberVariableDeclaration: true }],

Expand All @@ -167,12 +156,12 @@ module.exports = {
'no-template-curly-in-string': 'off', // Review one-by-one
'import/first': 'off',
'no-case-declarations': 'off',
'yoda': 'off',
yoda: 'off',
'no-undef-init': 'off',
'vars-on-top': 'off',
'no-var': 'off',
'lines-around-directive': 'off',
'strict': 'off',
strict: 'off',
'import/export': 'off',
'default-case': 'off',
'no-return-assign': 'off',
Expand Down Expand Up @@ -215,7 +204,66 @@ module.exports = {
'operator-assignment': 'off',
'import/no-named-default': 'off',
},
'ignorePatterns': [
overrides: [
{
files: ['packages/amplify-graphql-transformer-*/**/*.ts', 'packages/amplify-graphql-model-transformer/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/no-namespace': 'error',
'no-template-curly-in-string': 'error', // Review one-by-one
'import/first': 'error',
yoda: 'error',
'no-undef-init': 'error',
'vars-on-top': 'error',
'no-var': 'error',
'lines-around-directive': 'error',
strict: 'error',
'import/export': 'error',
'default-case': 'error',
'no-return-assign': 'error',
'import/no-duplicates': 'error',
'@typescript-eslint/interface-name-prefix': 'error',
'no-throw-literal': 'error',
'react/static-property-placement': 'error',
'import/no-extraneous-dependencies': 'error',
'spaced-comment': 'error',
'@typescript-eslint/no-array-constructor': 'error',
'prefer-rest-params': 'error',
'no-useless-escape': 'error',
'eol-last': 'error',
'no-useless-concat': 'error',
'no-multi-str': 'error',
'array-callback-return': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'no-extra-boolean-cast': 'error',
'no-async-promise-executor': 'error',
'no-nested-ternary': 'error',
'no-unused-expressions': 'error',
'no-sequences': 'error',
'react/jsx-filename-extension': 'error',
'react/state-in-constructor': 'error',
'react/no-access-state-in-setstate': 'error',
'react/jsx-closing-tag-location': 'error',
'react/sort-comp': 'error',
'jsx-a11y/label-has-associated-control': 'error',
'no-empty': 'error',
'import/no-unresolved': 'error',
'no-useless-constructor': 'error',
'import/no-useless-path-segments': 'error',
'no-cond-assign': 'error',
'new-cap': 'error',
'no-new': 'error',
'no-restricted-globals': 'error',
'no-constant-condition': 'error',
'operator-assignment': 'error',
'import/no-named-default': 'error',
},
},
],
ignorePatterns: [
'node_modules',
'dist',
'build',
Expand Down Expand Up @@ -263,8 +311,12 @@ module.exports = {
'/packages/graphql-*-transformer/lib',
'/packages/graphql-mapping-template/lib',
'/packages/graphql-transformer-*/lib',
'/packages/amplify-headless-interface/lib',
'/packages/amplify-util-headless-input/lib',
'packages/amplify-graphql-*transformer*/lib',
'/packages/amplify-provider-awscloudformation/lib',

// Ignore CHANGELOG.md files
'/packages/*/CHANGELOG.md'
]
'/packages/*/CHANGELOG.md',
],
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ packages/amplify-dynamodb-simulator/__test__/dynamodb-data
!.vscode/settings.json
!.vscode/extensions.json
packages/graphql*/lib
packages/amplify-graphql-transformer-*/lib
packages/amplify-cli/lib
packages/amplify-cli-core/lib
packages/amplify-mqtt-server/lib
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
'packages/graphql-transformers-e2e-tests/',
'packages/amplify-util-mock/src/__e2e__/',
'packages/amplify-ui-tests/',
'packages/amplify-graphql-transformer-interfaces/',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'core', 'node'],
collectCoverage: true,
Expand Down
14 changes: 6 additions & 8 deletions packages/amplify-cli-core/src/feature-flags/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,6 @@ export class FeatureFlags {
// DEVS: Register feature flags here
private registerFlags = (): void => {
// Examples:
// this.registerFlag('graphQLTransformer', [
// {
// name: 'transformerVersion',
// type: 'number',
// defaultValueForExistingProjects: 4,
// defaultValueForNewProjects: 5,
// },
// ]);
// this.registerFlag('keyTransformer', [
// {
// name: 'defaultQuery',
Expand All @@ -506,6 +498,12 @@ export class FeatureFlags {
defaultValueForExistingProjects: true,
defaultValueForNewProjects: true,
},
{
name: 'useExperimentalPipelinedTransformer',
type: 'boolean',
defaultValueForExistingProjects: false,
defaultValueForNewProjects: false,
},
]);
};
}
Loading