Skip to content

Commit 219ba0c

Browse files
authored
Add example (#346)
* Add @tsconfig/node18 * Create tsconfig.json * Update `lint` script * Add `parserOptions.project` * Downgrade node to v18.0.0 * Add @types/node * Create example.js * Create example.ts
1 parent b6a9e5c commit 219ba0c

File tree

7 files changed

+49
-2
lines changed

7 files changed

+49
-2
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
*/
99
const config = {
1010
extends: './index.js',
11+
parserOptions: {
12+
project: './tsconfig.json'
13+
},
1114
overrides: [
1215
// https://typescript-eslint.io/troubleshooting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file
1316
{

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.20.2
1+
18.0.0

example/example.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Try ESLint on this file
2+
3+
/**
4+
* @param {string} userName - user name
5+
* @returns {void}
6+
*/
7+
// FIXME: https://github.com/mightyiam/eslint-config-love/issues/1525
8+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
9+
const sayHello = (userName) => {
10+
console.log(`Hello, ${userName}`)
11+
}
12+
13+
const myName = 'Alice'
14+
sayHello(myName)

example/example.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Try ESLint on this file
2+
3+
/**
4+
* @param userName - user name
5+
*/
6+
const sayHello = (userName: string): void => {
7+
console.log(`Hello, ${userName}`)
8+
}
9+
10+
const myName = 'Alice'
11+
sayHello(myName)

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "46.0.0",
44
"description": "Recommended ESLint Shareable Config for TypeScript",
55
"scripts": {
6-
"lint": "eslint '**/*.js'",
6+
"lint": "eslint '**/*.{js,ts}'",
77
"prepublishOnly": "npm run lint"
88
},
99
"files": [
@@ -24,6 +24,8 @@
2424
},
2525
"devDependencies": {
2626
"@eslint-community/eslint-plugin-eslint-comments": "4.3.0",
27+
"@tsconfig/node18": "18.2.4",
28+
"@types/node": "18.0.0",
2729
"eslint": "8.57.0",
2830
"eslint-config-love": "47.0.0",
2931
"eslint-plugin-jsdoc": "48.2.3",

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@tsconfig/node18/tsconfig.json"
3+
}

0 commit comments

Comments
 (0)