Skip to content

Commit

Permalink
💎 style(eslint): eslint and prettier added to keep the styles in tact
Browse files Browse the repository at this point in the history
  • Loading branch information
sladg committed Feb 25, 2023
1 parent e74a212 commit 9932aa6
Show file tree
Hide file tree
Showing 8 changed files with 3,723 additions and 28 deletions.
68 changes: 68 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module.exports = {
extends: ['eslint:recommended', 'prettier'],
plugins: ['prettier', '@typescript-eslint', 'unused-imports', 'simple-import-sort', 'import'],
parser: '@typescript-eslint/parser',
env: {
node: true,
commonjs: true,
},
rules: {
'prettier/prettier': 'error',
'no-new': 0,
camelcase: 0,
'no-nested-ternary': 0,
'no-underscore-dangle': 0,
'no-shadow': 0,
'no-useless-return': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'unused-imports/no-unused-imports': 'error',
'no-multi-spaces': 'error',
'no-trailing-spaces': 'error',
'no-multiple-empty-lines': 'error',
'space-in-parens': 'error',
'no-mixed-spaces-and-tabs': 'warn',
eqeqeq: ['warn', 'always'],
'no-unused-vars': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [
['^react$'],
// Side effect imports.
['^\\u0000'],
// Node.js builtins prefixed with `node:`.
['^node:'],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
['^@fllite-fe/*'],
['^'],
// Relative imports.
// Anything that starts with a dot.
['^\\.'],
],
},
],
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'max-len': 'off',
'no-duplicate-imports': 'error',
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'computed-property-spacing': ['error', 'never'],
},
}
1 change: 1 addition & 0 deletions lib/cdk/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { handler, name, optimizerCodePath, optimizerLayerPath, version } from '@sladg/imaginex-lambda'
import { App } from 'aws-cdk-lib'
import path from 'path'

import { envConfig } from './config'
import { NextStandaloneStack } from './stack'

Expand Down
1 change: 1 addition & 0 deletions lib/cdk/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Runtime } from 'aws-cdk-lib/aws-lambda'
import { bool, cleanEnv, num, str } from 'envalid'

import { DEFAULT_MEMORY as IMAGE_LAMBDA_DEFAULT_MEMORY, DEFAULT_TIMEOUT as IMAGE_LAMBDA_DEFAULT_TIMEOUT } from './utils/imageLambda'
import { DEFAULT_MEMORY as SERVER_LAMBDA_DEFAULT_MEMORY, DEFAULT_TIMEOUT as SERVER_LAMBDA_DEFAULT_TIMEOUT } from './utils/serverLambda'

Expand Down
3 changes: 2 additions & 1 deletion lib/cdk/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IDistribution } from 'aws-cdk-lib/aws-cloudfront'
import { HttpOrigin } from 'aws-cdk-lib/aws-cloudfront-origins'
import { Function } from 'aws-cdk-lib/aws-lambda'
import { Bucket } from 'aws-cdk-lib/aws-s3'

import { CustomStackProps, MappedDomain } from './types'
import { setupApiGateway, SetupApiGwProps } from './utils/apiGw'
import { setupCfnCertificate, SetupCfnCertificateProps } from './utils/cfnCertificate'
Expand Down Expand Up @@ -97,7 +98,7 @@ export class NextStandaloneStack extends Stack {
domains: this.domains,
})

if (!!config.redirectFromApex) {
if (config.redirectFromApex) {
this.setupApexRedirect({
domain: this.domains[0],
})
Expand Down
3 changes: 2 additions & 1 deletion lib/cli/pack.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { mkdirSync, rmSync, writeFileSync } from 'fs'
import { tmpdir } from 'os'
import path from 'path'

import { nextServerConfigRegex } from '../consts'
import { findInFile, findPathToNestedFile, validateFolderExists, validatePublicFolderStructure, zipFolder, zipMultipleFoldersOrFiles } from '../utils'
import { findInFile, findPathToNestedFile, validateFolderExists, validatePublicFolderStructure, zipMultipleFoldersOrFiles } from '../utils'

interface Props {
standaloneFolder: string
Expand Down
1 change: 1 addition & 0 deletions lib/server-handler/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable */
// ! This is needed for nextjs to correctly resolve.
process.chdir(__dirname)
process.env.NODE_ENV = 'production'
Expand Down
Loading

0 comments on commit 9932aa6

Please sign in to comment.