Skip to content

Commit

Permalink
chore: add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeekoZhu committed Sep 2, 2022
1 parent da6f2e8 commit 368d397
Show file tree
Hide file tree
Showing 7 changed files with 1,114 additions and 24 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: ['plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
};
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ nx run-many --target=dev --all

Then, visit http://localhost:32000/dashboard

### lint

```bash
nx lint dashboard
```

## TODO

- [ ] auto build `core` during debugging with `demo`
Expand Down
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
},
"affected": {
"defaultBase": "main"
}
},
"plugins": ["./tools/dist/nx-plugins"]
}
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@
],
"devDependencies": {
"@nrwl/devkit": "14.5.10",
"@nrwl/linter": "^14.6.3",
"@nrwl/nx-cloud": "14.5.0",
"@nrwl/workspace": "14.5.10",
"@types/node": "latest",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"change-case": "^4.1.2",
"eslint": "^8.23.0",
"husky": "^8.0.0",
"nx": "14.5.10",
"prettier": "^2.7.1"
},
"scripts": {
"prepare": "husky install"
"prepare": "husky install",
"postinstall": "cd ./tools && tsc -p ./tsconfig.tools.json"
},
"dependencies": {}
}
22 changes: 22 additions & 0 deletions tools/nx-plugins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as path from 'path';

export const projectFilePatterns = ['package.json'];

function registerProjectTargets(projectFilePath) {
const projectDir = (...items: string[]) => path.join(path.dirname(projectFilePath), ...items);
return {
lint: {
executor: '@nrwl/linter:eslint',
options: {
lintFilePatterns: [
projectDir('src/**/*.ts'),
projectDir('src/**/*.tsx'),
projectDir('cypress/**/*.tsx'),
projectDir('cypress/**/*.ts'),
],
},
},
};
}

exports.registerProjectTargets = registerProjectTargets;
2 changes: 1 addition & 1 deletion tools/tsconfig.tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"sourceMap": false,
"skipLibCheck": true
},
"exclude": ["node_modules"]
"exclude": ["node_modules", "dist"]
}
Loading

0 comments on commit 368d397

Please sign in to comment.