Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2f00b3
commit 74b5606
Showing
7 changed files
with
121 additions
and
1 deletion.
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
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,47 @@ | ||
const config = { | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
}, | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint', 'import', 'jsx-a11y'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'prettier/@typescript-eslint', | ||
'plugin:import/typescript', | ||
], | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'import/no-default-export': 'error', | ||
'import/no-deprecated': 'warn', | ||
'import/order': [ | ||
'error', | ||
{ | ||
pathGroupsExcludedImportTypes: ['builtin'], | ||
groups: [ | ||
'builtin', | ||
'external', | ||
'internal', | ||
'unknown', | ||
'parent', | ||
'sibling', | ||
'index', | ||
], | ||
'newlines-between': 'always', | ||
alphabetize: { order: 'asc' }, | ||
}, | ||
], | ||
'import/prefer-default-export': 'off', | ||
}, | ||
settings: { | ||
'import/ignore': ['node_modules'], | ||
}, | ||
} | ||
|
||
module.exports = config |
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,3 @@ | ||
# @jdp-dev/eslint-config-typescript | ||
|
||
My shareable [ESLint](https://eslint.org/) config for [TypeScript](https://www.typescriptlang.org/) projects. |
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 @@ | ||
const test = require('tape') | ||
|
||
test('entry point parses', (t) => { | ||
t.doesNotThrow(() => require('..'), 'index does not throw') | ||
t.end() | ||
}) |
20 changes: 20 additions & 0 deletions
20
packages/eslint-config-typescript/__tests__/validate-config.js
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,20 @@ | ||
const eslint = require('eslint') | ||
const test = require('tape') | ||
|
||
test('load config in eslint to validate all rule syntax is correct', (t) => { | ||
const cli = new eslint.CLIEngine({ | ||
useEslintrc: false, | ||
configFile: 'index.js', | ||
}) | ||
|
||
const code = ` | ||
const greet = (name: string): void => { | ||
console.log(\`Hello, \${name}!\`) | ||
} | ||
` | ||
|
||
const result = cli.executeOnText(code) | ||
|
||
t.equal(result.errorCount, 0) | ||
t.end() | ||
}) |
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 @@ | ||
module.exports = require('./.eslintrc.js') |
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,44 @@ | ||
{ | ||
"name": "@jdp-dev/eslint-config-typescript", | ||
"version": "0.0.3", | ||
"description": "My shareable ESLint config for TypeScript projects.", | ||
"private": false, | ||
"homepage": "https://github.com/john-d-pelingo/jdp-scripts", | ||
"author": { | ||
"email": "johndarrylpelingo@gmail.com", | ||
"name": "John Darryl Pelingo", | ||
"url": "https://johndpelingo.com" | ||
}, | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/john-d-pelingo/jdp-scripts", | ||
"directory": "packages/eslint-config" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/john-d-pelingo/jdp-scripts/issues" | ||
}, | ||
"main": "index.js", | ||
"scripts": { | ||
"lint": "eslint . --config=.eslintrc.js", | ||
"test": "npm run lint && tape __tests__/*.js" | ||
}, | ||
"peerDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.9.0", | ||
"@typescript-eslint/parser": "^4.9.0", | ||
"eslint": "^7.14.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"typescript": "^4.1.2" | ||
}, | ||
"dependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.9.0", | ||
"@typescript-eslint/parser": "^4.9.0", | ||
"eslint": "^7.14.0", | ||
"eslint-config-airbnb-typescript": "^12.0.0", | ||
"eslint-config-prettier": "^6.15.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"typescript": "^4.1.2" | ||
} | ||
} |