-
-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add eslint configuration and netlify functions (#2670)
- Loading branch information
1 parent
9c0a350
commit 3cac6a7
Showing
21 changed files
with
1,594 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,295 @@ | ||
{ | ||
"extends": [ | ||
"airbnb-base", | ||
"next/core-web-vitals", | ||
"eslint:recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"plugins": [ | ||
"react", | ||
"jsx-a11y" | ||
], | ||
"rules": { | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"singleQuote": true, | ||
"endOfLine": "auto" | ||
} | ||
] | ||
}, | ||
"overrides": [ | ||
// Configuration for TypeScript files | ||
{ | ||
"files": ["**/*.ts", "**/*.tsx", "netlify/*.ts"], | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"tailwindcss", | ||
"unused-imports", | ||
"simple-import-sort" | ||
], | ||
"extends": [ | ||
"plugin:tailwindcss/recommended", | ||
"airbnb-typescript", | ||
"next/core-web-vitals", | ||
"plugin:prettier/recommended" | ||
], | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": { | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"singleQuote": true, | ||
"endOfLine": "auto" | ||
} | ||
], | ||
"react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable | ||
"react/require-default-props": "off", // Allow non-defined react props as undefined | ||
"react/jsx-props-no-spreading": "off", // _app.tsx uses spread operator and also, react-hook-form | ||
"react-hooks/exhaustive-deps": "off", // Incorrectly report needed dependency with Next.js router | ||
"@next/next/no-img-element": "off", // We currently not using next/image because it isn't supported with SSG mode | ||
"@next/next/link-passhref": "off", // Only needed when the child of Link wraps an <a> tag | ||
"@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier | ||
"@typescript-eslint/consistent-type-imports": "error", // Ensure `import type` is used when it's necessary | ||
"no-restricted-syntax": [ | ||
"error", | ||
"ForInStatement", | ||
"LabeledStatement", | ||
"WithStatement" | ||
], // Overrides Airbnb configuration and enable no-restricted-syntax | ||
"import/prefer-default-export": "off", // Named export is easier to refactor automatically | ||
"tailwindcss/no-custom-classname": "off", // Disabled otherwise nightmare to allow each custom tailwind classes | ||
"simple-import-sort/imports": "error", // Import configuration for `eslint-plugin-simple-import-sort` | ||
"simple-import-sort/exports": "error", // Export configuration for `eslint-plugin-simple-import-sort` | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"class-methods-use-this": "off", | ||
"unused-imports/no-unused-imports": "error", | ||
"unused-imports/no-unused-vars": [ | ||
"error", | ||
{ "argsIgnorePattern": "^_" } | ||
], | ||
// Variables | ||
"init-declarations": "off", | ||
"no-catch-shadow": "off", | ||
"no-delete-var": "error", | ||
"no-label-var": "error", | ||
"no-restricted-globals": "error", | ||
"no-shadow": "off", | ||
"no-shadow-restricted-names": "error", | ||
"no-undef": "error", | ||
"no-undef-init": "error", | ||
"no-undefined": "off", | ||
"no-unused-vars": "error", | ||
"no-use-before-define": "error", | ||
// Styling | ||
"array-bracket-newline": "off", | ||
"array-bracket-spacing": "error", | ||
"array-element-newline": "off", | ||
"block-spacing": "error", | ||
"brace-style": [ | ||
"off", | ||
"stroustrup", | ||
{ | ||
"allowSingleLine": true | ||
} | ||
], | ||
"camelcase": "off", | ||
"capitalized-comments": "off", | ||
"comma-dangle": [ | ||
"error", | ||
"never" | ||
], | ||
"comma-spacing": [ | ||
2, | ||
{ | ||
"before": false, | ||
"after": true | ||
} | ||
], | ||
"comma-style": [ | ||
"error", | ||
"last" | ||
], | ||
"eol-last": "error", | ||
"func-call-spacing": "error", | ||
"func-name-matching": "error", | ||
"func-names": "off", | ||
"func-style": "off", | ||
"function-paren-newline": [ | ||
"error", | ||
"never" | ||
], | ||
"implicit-arrow-linebreak": [ | ||
"error", | ||
"beside" | ||
], | ||
"indent": [ | ||
"error", | ||
2, | ||
{ | ||
"VariableDeclarator": { | ||
"var": 1, | ||
"let": 1, | ||
"const": 1 | ||
}, | ||
"SwitchCase": 1 | ||
} | ||
], | ||
"jsx-quotes": [ | ||
"error", | ||
"prefer-single" | ||
], | ||
"key-spacing": "error", | ||
"keyword-spacing": "error", | ||
"line-comment-position": "off", | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"lines-around-comment": [ | ||
"error", | ||
{ | ||
"beforeBlockComment": true, | ||
"afterBlockComment": false, | ||
"beforeLineComment": false, | ||
"afterLineComment": false, | ||
"allowBlockStart": true, | ||
"allowBlockEnd": false, | ||
"allowObjectStart": true, | ||
"allowObjectEnd": false, | ||
"allowArrayStart": true, | ||
"allowArrayEnd": false | ||
} | ||
], | ||
"max-depth": "error", | ||
"max-len": [ | ||
"error", | ||
{ | ||
"code": 120 | ||
} | ||
], | ||
"max-lines": [ | ||
"error", | ||
{ | ||
"max": 2000 | ||
} | ||
], | ||
"max-nested-callbacks": "error", | ||
"max-statements-per-line": [ | ||
"error", | ||
{ | ||
"max": 2 | ||
} | ||
], | ||
"multiline-comment-style": "off", | ||
"multiline-ternary": "off", | ||
"new-cap": "off", | ||
"new-parens": "error", | ||
"newline-per-chained-call": [ | ||
"error", | ||
{ | ||
"ignoreChainWithDepth": 4 | ||
} | ||
], | ||
"newline-after-var": ["error", "always"], | ||
"no-array-constructor": "error", | ||
"no-lonely-if": "error", | ||
"no-mixed-operators": "off", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multi-assign": "off", | ||
"no-multiple-empty-lines": [ | ||
"error", | ||
{ | ||
"max": 1 | ||
} | ||
], | ||
"no-negated-condition": "error", | ||
"no-nested-ternary": "error", | ||
"no-new-object": "error", | ||
"no-plusplus": "off", | ||
"no-tabs": "error", | ||
"no-ternary": "off", | ||
"no-trailing-spaces": "error", | ||
"no-unneeded-ternary": "error", | ||
"no-whitespace-before-property": "error", | ||
"nonblock-statement-body-position": "error", | ||
"object-curly-newline": "off", | ||
"object-curly-spacing": [ | ||
"error", | ||
"always" | ||
], | ||
"object-property-newline": "off", | ||
"padded-blocks": [ | ||
"error", | ||
"never" | ||
], | ||
"padding-line-between-statements": [ | ||
"error", | ||
{ | ||
"blankLine": "always", | ||
"prev": "*", | ||
"next": "return" | ||
}, | ||
{ | ||
"blankLine": "always", | ||
"prev": [ | ||
"const", | ||
"let", | ||
"var" | ||
], | ||
"next": "*" | ||
}, | ||
{ | ||
"blankLine": "any", | ||
"prev": [ | ||
"const", | ||
"let", | ||
"var" | ||
], | ||
"next": [ | ||
"const", | ||
"let", | ||
"var" | ||
] | ||
} | ||
], | ||
"quote-props": [ | ||
"error", | ||
"as-needed" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"require-jsdoc": "warn", | ||
"semi": "error", | ||
"semi-spacing": "error", | ||
"semi-style": [ | ||
"error", | ||
"last" | ||
], | ||
"sort-keys": "off", | ||
"sort-vars": "off", | ||
"space-before-blocks": "error", | ||
"space-before-function-paren": "error", | ||
"space-in-parens": "error", | ||
"space-infix-ops": "error", | ||
"space-unary-ops": "error", | ||
"spaced-comment": [ | ||
"error", | ||
"always", | ||
{ | ||
"block": { | ||
"exceptions": [ | ||
"!" | ||
] | ||
} | ||
} | ||
], | ||
"switch-colon-spacing": "error" | ||
} | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"jsxSingleQuote": true, | ||
"arrowParens": "always", | ||
"trailingComma": "es5" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.