diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bbf3e21 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/backend/base-backend-package/.eslintrc.json b/backend/base-backend-package/.eslintrc.json index 8f793e0..98d1af0 100644 --- a/backend/base-backend-package/.eslintrc.json +++ b/backend/base-backend-package/.eslintrc.json @@ -1,37 +1,37 @@ { - "env": { - "browser": true, - "es6": true, - "jest": true - }, - "extends": [ - "standard", - "eslint:recommended", - "prettier", - "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended" // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. - ], - "ignorePatterns": ["node_modules/*", "lib/*"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module" - }, - "plugins": [ - "prettier", - "@typescript-eslint", - "jest" - ], - "rules": { - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/explicit-function-return-type": "error", - "@typescript-eslint/explicit-module-boundary-types": "error", - "jest/no-disabled-tests": "warn", - "jest/no-focused-tests": "error", - "jest/no-identical-title": "error", - "jest/prefer-to-have-length": "warn", - "jest/valid-expect": "error", - "no-underscore-dangle": "off" - } + "env": { + "node": true, + "es6": true, + "jest": true + }, + "extends": [ + "standard", + "eslint:recommended", + "prettier", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. + ], + "ignorePatterns": ["node_modules/*", "lib/*"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": [ + "prettier", + "@typescript-eslint", + "jest" + ], + "rules": { + "@typescript-eslint/no-unused-vars": "error", + "@typescript-eslint/explicit-function-return-type": "error", + "@typescript-eslint/explicit-module-boundary-types": "error", + "jest/no-disabled-tests": "warn", + "jest/no-focused-tests": "error", + "jest/no-identical-title": "error", + "jest/prefer-to-have-length": "warn", + "jest/valid-expect": "error", + "no-underscore-dangle": "off" + } } diff --git a/backend/tsconfig.json b/backend/tsconfig.json new file mode 100644 index 0000000..d88230c --- /dev/null +++ b/backend/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "declaration": true, + "outDir": "./lib", + "noImplicitAny": true, + "sourceMap": true, + "strictNullChecks": true, + "allowSyntheticDefaultImports": true, + "preserveSymlinks": true, + "inlineSources": true, + "removeComments": true, + "forceConsistentCasingInFileNames": true, + "strict": true + }, + "include": ["src"], + "exclude": ["node_modules"] +} \ No newline at end of file diff --git a/eslint/README.md b/eslint/README.md new file mode 100644 index 0000000..a093921 --- /dev/null +++ b/eslint/README.md @@ -0,0 +1,24 @@ +# @bufferapp/eslint-config + +This is the standard ESLint config files for the projects within the @bufferapp + GitHub organization. + +## Usage + +```console +npm install --save-dev @bufferapp/eslint-config eslint +# or +yarn add -D @bufferapp/eslint-config eslint +``` + +NOTE: We will need to define custom installation instructions for front-end + and backend-based configs, depending on those we will have different + `peerDependencies` for the ESLint configs. + +And then, on your `.eslintrc` use + +``` +"extends": "@bufferapp/eslint-config-backend" +#or +"extends": "@bufferapp/eslint-config-frontend" +``` diff --git a/eslint/backend.js b/eslint/backend.js new file mode 100644 index 0000000..c4baf61 --- /dev/null +++ b/eslint/backend.js @@ -0,0 +1,28 @@ +module.exports = { + extends: [ + "./index.js", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. + ], + plugins: [ + "typescript-eslint", + ], + parser: "@typescript-eslint/parser", + ignorePatterns: ["node_modules/*", "built/*", "lib/*", "build/*"], + env: { + node: true, + es6: true, + jest: true, + }, + rules: { + "@typescript-eslint/no-unused-vars": "error", + "@typescript-eslint/explicit-function-return-type": "error", + "@typescript-eslint/explicit-module-boundary-types": "error", + "jest/no-disabled-tests": "warn", + "jest/no-focused-tests": "error", + "jest/no-identical-title": "error", + "jest/prefer-to-have-length": "warn", + "jest/valid-expect": "error", + "no-underscore-dangle": "off" + } +} diff --git a/eslint/frontend.js b/eslint/frontend.js new file mode 100644 index 0000000..9b68614 --- /dev/null +++ b/eslint/frontend.js @@ -0,0 +1,15 @@ +module.exports = { + extends: [ + "./index.js", + "plugin:react/recommended", + "prettier/react" + ], + plugins: [ + "react", + ], + env: { + browser: true, + es6: true, + jest: true, + } +} diff --git a/eslint/index.js b/eslint/index.js new file mode 100644 index 0000000..439a86d --- /dev/null +++ b/eslint/index.js @@ -0,0 +1,13 @@ +module.exports = { + extends: [ + "standard", + "eslint:recommended", + "prettier", + ], + parserOptions: { + ecmaVersion: 2018, + sourceType: "module" + }, + plugins: ["prettier", "jest"], +} + diff --git a/eslint/package.json b/eslint/package.json new file mode 100644 index 0000000..c900afa --- /dev/null +++ b/eslint/package.json @@ -0,0 +1,14 @@ +{ + "name": "@bufferapp/eslint-config-bufferapp", + "version": "0.0.1", + "description": "This package provides Buffer's ESLint as an extensible shared config, and specific backend/frontend setups.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Mike San Román ", + "license": "ISC", + "peerDependencies": { + "eslint": ">= 6" + } +} diff --git a/prettier/README.md b/prettier/README.md new file mode 100644 index 0000000..f784604 --- /dev/null +++ b/prettier/README.md @@ -0,0 +1,17 @@ +# @bufferapp/prettier-config + +This is the standard Prettier config file for the projects within the @bufferapp GitHub organization. + +## Usage + +```console +npm install --save-dev @bufferapp/prettier-config prettier +# or +yarn add -D @bufferapp/prettier-config prettier +``` + +And then, on your `package.json` use + +``` +"prettier": "@bufferapp/prettier-config" +``` diff --git a/prettier/index.js b/prettier/index.js new file mode 100644 index 0000000..84f8e69 --- /dev/null +++ b/prettier/index.js @@ -0,0 +1,7 @@ +module.exports = { + semi: false, + singleQuote: true, + trailingComma: "all", + tabWidth: 2, + bracketSpacing: true +} diff --git a/prettier/package-lock.json b/prettier/package-lock.json new file mode 100644 index 0000000..d87d874 --- /dev/null +++ b/prettier/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "@bufferapp/prettier-config", + "version": "0.0.1", + "lockfileVersion": 1 +} diff --git a/prettier/package.json b/prettier/package.json new file mode 100644 index 0000000..d0d7f47 --- /dev/null +++ b/prettier/package.json @@ -0,0 +1,14 @@ +{ + "name": "@bufferapp/prettier-config", + "version": "0.0.1", + "description": "Buffer standard Prettier configuration", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Mike San Román ", + "license": "ISC", + "peerDependencies": { + "prettier": "^2.0.5" + } +}