-
Notifications
You must be signed in to change notification settings - Fork 1
Add Prettier and ESLint standard configs #5
base: main
Are you sure you want to change the base?
Changes from all commits
4f930b1
ad2ac63
a5358a4
a6f5f90
e864f01
9f2e811
e55295a
d741d06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[*] | ||
indent_style = space | ||
indent_size = 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"outDir": "./lib", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. todo: change this for |
||
"noImplicitAny": true, | ||
"sourceMap": true, | ||
"strictNullChecks": true, | ||
"allowSyntheticDefaultImports": true, | ||
"preserveSymlinks": true, | ||
"inlineSources": true, | ||
"removeComments": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true | ||
}, | ||
"include": ["src"], | ||
"exclude": ["node_modules"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/*"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should standardize our tsconfig outDir folder for all repositories. Right now, we have: lib, build, and built depending on repos. I would go for built 😊 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. built sounds good to me! |
||
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" | ||
} | ||
Comment on lines
+17
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tempted to add these rules to the index.js as they should be applied to both FE and BE :in my opinion. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
extends: [ | ||
"./index.js", | ||
"plugin:react/recommended", | ||
"prettier/react" | ||
], | ||
plugins: [ | ||
"react", | ||
], | ||
env: { | ||
browser: true, | ||
es6: true, | ||
jest: true, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
extends: [ | ||
"standard", | ||
"eslint:recommended", | ||
"prettier", | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module" | ||
}, | ||
plugins: ["prettier", "jest"], | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>", | ||
"license": "ISC", | ||
"peerDependencies": { | ||
"eslint": ">= 6" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
semi: false, | ||
singleQuote: true, | ||
trailingComma: "all", | ||
tabWidth: 2, | ||
bracketSpacing: true | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>", | ||
"license": "ISC", | ||
"peerDependencies": { | ||
"prettier": "^2.0.5" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: replace with actual eslint package we are creating here