Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
benbender committed Jan 1, 2021
1 parent 1b16f4c commit c6ef0fb
Show file tree
Hide file tree
Showing 11 changed files with 2,445 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Benjamin Bender
Copyright (c) 2020 Benjamin Bender <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# @webdev-config/eslint
ESLint configuration to be shared across repositories.

# Install
`npm i -D @webdev-config/eslint`

# Configure
Append to `package.json`:

`"eslintConfig": { "extends": "./node_modules/@webdev-config/eslint" }`

# Execute
`eslint [path regex]`

`eslint ./src/**`

`eslint ./index.ts`

# Test
Build test code inside of `index.ts`, use `package.json` scripts `test` and `fix` to execute local testing.
21 changes: 21 additions & 0 deletions eslint-config/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Benjamin Bender <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions eslint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @webdev-config/eslint
ESLint configuration to be shared across repositories.

# Install
`npm i -D @benbender/eslint-config`

`npx install-peerdeps --dev @benbender/eslint-config`
59 changes: 59 additions & 0 deletions eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module.exports = {
root: true,
env: {
es6: true,
node: true,
browser: true,
jest: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
node: {
paths: [".", "src"],
},
},
},
plugins: [
"@typescript-eslint",
"prettier",
"promise",
"import",
"react",
"react-hooks",
"jest-dom",
"testing-library",
"jsx-a11y",
"@next/eslint-plugin-next",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended",
"plugin:promise/recommended",
"prettier/@typescript-eslint",
"prettier/react",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jest-dom/recommended",
"plugin:testing-library/react",
"plugin:jsx-a11y/recommended",
],
rules: {
"prettier/prettier": "error", // Let prettier rule our formatting
"react/prop-types": "off", // Ignore prop-types as we are using typescript
"react/react-in-jsx-scope": "off", // React is always in scope with Next.js
"jsx-a11y/anchor-is-valid": "off", // Doesn't play well with next/link
},
};
66 changes: 66 additions & 0 deletions eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "@benbender/eslint-config",
"version": "0.1.0",
"description": "ESLint configuration to be shared across repositories.",
"main": "index.js",
"author": "Benjamin Bender <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/benbender/cp-common.git",
"directory": "eslint-config"
},
"bugs": {
"url": "https://github.com/benbender/cp-common/issues"
},
"homepage": "https://github.com/benbender/cp-common#readme",
"keywords": [
"eslint",
"configuration"
],
"scripts": {
"test": "eslint ./index.js",
"lint": "eslint ./index.js",
"lint:fix": "eslint ./index.js --fix"
},
"files": [
"index.js"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.11.0",
"@typescript-eslint/parser": "^4.11.0",
"@next/eslint-plugin-next": "^10.0.4",
"eslint": "^7.16.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest-dom": "^3.6.5",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^3.10.1",
"prettier": "^2.2.1",
"prettier-plugin-tailwind": "^2.2.8"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^4.11.0",
"@typescript-eslint/parser": "^4.11.0",
"@next/eslint-plugin-next": "^10.0.4",
"eslint": "^7.16.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest-dom": "^3.6.5",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^3.10.1",
"prettier": "^2.2.1",
"prettier-plugin-tailwind": "^2.2.8"
},
"eslintConfig": {
"extends": "./index.js"
}
}
30 changes: 30 additions & 0 deletions eslint-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": "src"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "cp-common",
"version": "0.1.0",
"description": "Common packages for my work",
"main": "index.js",
"repository": "https://github.com/benbender/cp-common.git",
"author": "Benjamin Bender <[email protected]>",
"license": "MIT",
"private": true,
"workspaces": [
"eslint-config"
],
"devDependencies": {
"@types/node": "^14.14.19",
"typescript": "^4.1.3"
}
}
Loading

0 comments on commit c6ef0fb

Please sign in to comment.