Skip to content

Commit

Permalink
feat: init monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeardEth committed Feb 28, 2022
1 parent 26fcbfe commit 1393df1
Show file tree
Hide file tree
Showing 190 changed files with 309,174 additions and 496 deletions.
215 changes: 215 additions & 0 deletions .eslintrc.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
/**
* Default eslint base configuration that can be extended by apps/packages
* in the monorepo
* @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md
*/

module.exports = {
root: true,
env: {
node: true,
es6: true,
},
ignorePatterns: ['**/node_modules', '**/dist', '**/build'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
globalReturn: false,
},
ecmaVersion: 2020,
project: ['tsconfig.json'],
sourceType: 'module',
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {},
},
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:regexp/recommended',
'plugin:prettier/recommended',
],
globals: {
context: 'readonly',
cy: 'readonly',
assert: 'readonly',
Cypress: 'readonly',
},
rules: {
'spaced-comment': [
'error',
'always',
{
line: {
markers: ['/'],
exceptions: ['-', '+'],
},
block: {
markers: ['!'],
exceptions: ['*'],
balanced: true,
},
},
],
'linebreak-style': ['error', 'unix'],
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': [
'error',
{ allow: ['private-constructors'] },
],
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'import/default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-named-as-default': 'off',
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
],
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'variable',
format: ['camelCase'],
leadingUnderscore: 'allow',
},
{
selector: ['function'],
format: ['camelCase'],
},
{
selector: 'parameter',
format: ['camelCase'],
leadingUnderscore: 'allow',
},
{
selector: 'class',
format: ['PascalCase'],
},
{
selector: 'classProperty',
format: ['camelCase'],
},
{
selector: 'objectLiteralProperty',
format: [
'camelCase',
// Some external libraries use snake_case for params
'snake_case',
// Env variables are generally uppercase
'UPPER_CASE',
],
},
{
selector: ['typeAlias', 'interface'],
format: ['PascalCase'],
},
{
selector: ['typeProperty'],
format: ['camelCase'],
},
{
selector: ['typeParameter'],
format: ['PascalCase'],
},
],
},
overrides: [
{
// For performance run sonarjs/recommended on regular code, not test files.
files: ['**/*.{js,jsx,ts,tsx}'],
excludedFiles: ['**/__tests__/**/*.{js,jsx,ts,tsx}'],
extends: ['plugin:sonarjs/recommended'],
rules: {
'sonarjs/no-nested-template-literals': 'off',
},
},
{
// For performance run jest/recommended on test files, not regular code
files: ['**/?(*.)+(test).{js,jsx,ts,tsx}'],
extends: ['plugin:jest/recommended'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
},
},
{
// To disambiguate unit from e2e (playwright) test files, the *.spec.ts
// is used across this repo, so we can apply a different ruleset.
files: ['*.spec.ts'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
},
},
// Fine-tune naming convention react typescript jsx (function components)
{
files: ['*.tsx'],
rules: {
'@typescript-eslint/naming-convention': [
'warn',
{
selector: 'variable',
format: ['camelCase', 'PascalCase'],
},
{
selector: ['function'],
format: ['camelCase', 'PascalCase'],
},
{
selector: 'parameter',
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow',
},
],
},
},
{
files: ['*.js'],
parser: 'espree',
parserOptions: {
ecmaVersion: 2020,
},
rules: {
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/no-all-duplicated-branches': 'off',
'@typescript-eslint/consistent-type-exports': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'import/order': 'off',
},
},
],
};
Loading

0 comments on commit 1393df1

Please sign in to comment.