Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] rework eslint config to use proper TS projects #5590

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ coverage/
**/*.d.ts
/docs/_preview
/docs/_loopback.io
**/.eslintrc.js
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad idea. We are running Prettier as part of eslint, this line disables prettier formatting checks for .eslintrc files.

14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

const {packages} = require('./lerna.json');
const projects = packages
.filter(spec => spec !== 'docs')
.map(spec => `${spec}/tsconfig.json`);

module.exports = {
root: true,
extends: ['./packages/eslint-config/eslintrc.js'],
parserOptions: {
project: [
'tsconfig.eslint.json',
...projects,
'packages/tsdocs/fixtures/monorepo/packages/*/tsconfig.json',
],
tsconfigRootDir: __dirname,
},
};
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
# is not able to access type information for dependencies
script:
- lerna bootstrap
- npm run build
- npm run lint

- node_js: "12"
Expand Down
2 changes: 0 additions & 2 deletions packages/eslint-config/eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ module.exports = {
* See https://github.com/typescript-eslint/typescript-eslint/issues/389
*/
project: getProjectFile(),
// See https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration
createDefaultProgram: true,
ecmaFeatures: {
ecmaVersion: 2017,
jsx: false,
Expand Down
20 changes: 0 additions & 20 deletions tsconfig.build.json

This file was deleted.

28 changes: 28 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"allowJs": true,
},
"include": [
"acceptance/*/docker.setup.js",
"bin/*.js",
"commitlint.config.js",
"docs/bin/*.js",
"examples/lb3-application/lb3app/**/*.js",
"examples/passport-login/web-application/express-app.js",
"extensions/context-explorer/public/**/*.js",
"packages/booter-lb3app/fixtures/**/*.js",
"packages/build/**/*.js",
"packages/build/**/*.ts",
"packages/cli/**/*.js",
"packages/cli/**/*.ts",
"packages/eslint-config/eslintrc.js",
"packages/repository/examples/**/*.js",
"packages/repository/examples/**/*.ts",
"packages/tsdocs/bin/*.js",
"packages/tsdocs/fixtures/**/*.js"
],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion point: instead of adding all of those files to the dummy tsconfig for eslint only, should we add them to "real" typescript projects and run them through the compiler to get basic type checks?

"exclude": [
"**/node_modules/**/*"
]
}