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

chore: cleanup repo lint + typechecking #6473

Merged
merged 7 commits into from Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 0 additions & 7 deletions .eslintignore
Expand Up @@ -7,12 +7,5 @@ __snapshots__
.docusaurus
build

packages/eslint-plugin-tslint/tests

packages/website/**/*.js
packages/website/**/*.d.ts
packages/website-eslint/**/*.js
packages/website-eslint/**/*.d.ts

# Files copied as part of the build
packages/types/src/generated/**/*.ts
38 changes: 33 additions & 5 deletions .eslintrc.js
@@ -1,3 +1,5 @@
// @ts-check
/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */
module.exports = {
root: true,
plugins: [
Expand All @@ -14,6 +16,9 @@ module.exports = {
es6: true,
node: true,
},
globals: {
globalThis: true,
bradzacher marked this conversation as resolved.
Show resolved Hide resolved
},
extends: [
'eslint:recommended',
'plugin:eslint-plugin/recommended',
Expand All @@ -25,7 +30,6 @@ module.exports = {
project: [
'./tsconfig.eslint.json',
'./packages/*/tsconfig.json',
'./tests/integration/tsconfig.json',
/**
* We are currently in the process of transitioning to nx's out of the box structure and
* so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json
Expand Down Expand Up @@ -156,6 +160,7 @@ module.exports = {
'eslint-disable-line',
'eslint-disable-next-line',
'eslint-enable',
'global',
],
},
],
Expand Down Expand Up @@ -202,6 +207,18 @@ module.exports = {
'one-var': ['error', 'never'],
},
overrides: [
{
files: ['*.js'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
rules: {
// turn off other type-aware rules
'deprecation/deprecation': 'off',
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',

// turn off rules that don't apply to JS code
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
// all test files
{
files: [
Expand All @@ -210,9 +227,8 @@ module.exports = {
'./packages/*/tests/**/spec.ts',
'./packages/*/tests/**/test.ts',
'./packages/parser/tests/**/*.ts',
'./tests/integration/**/*.test.ts',
'./tests/integration/integration-test-base.ts',
'./tests/integration/pack-packages.ts',
'./packages/integration-tests/tools/integration-test-base.ts',
'./packages/integration-tests/tools/pack-packages.ts',
],
env: {
'jest/globals': true,
Expand Down Expand Up @@ -312,7 +328,12 @@ module.exports = {
},
// tools and tests
{
files: ['**/tools/**/*.*t*', '**/tests/**/*.ts'],
files: [
'**/tools/**/*.*t*',
'**/tests/**/*.ts',
'./packages/repo-tools/**/*.*t*',
'./packages/repo-tests/**/*.*t*',
],
rules: {
// allow console logs in tools and tests
'no-console': 'off',
Expand Down Expand Up @@ -373,5 +394,12 @@ module.exports = {
'no-console': 'off',
},
},
{
files: ['./packages/website-eslint/src/mock/**/*.js'],
rules: {
// mocks have to mirror their original
'import/no-default-export': 'off',
},
},
],
};
10 changes: 2 additions & 8 deletions .prettierignore
@@ -1,22 +1,16 @@
**/tests/fixtures/**/*
!packages/scope-manager/tests/fixtures/**/*
**/tests/fixture-project/**/*
**/dist
**/coverage
**/.vscode
**/.nyc_output
**/.vs
packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.js
packages/eslint-plugin/src/configs/*.json
CONTRIBUTORS.md
packages/ast-spec/src/*/*/fixtures/_error_/*/fixture.ts

# prettier doesn't yet support auto-accessors
packages/ast-spec/src/element/AccessorProperty/fixtures
# prettier errors on this case because it's semantically valid
packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved

# Ignore CHANGELOG.md files to avoid issues with automated release job
CHANGELOG.md

packages/website/.docusaurus
packages/website/build
packages/website/src/vendor
21 changes: 9 additions & 12 deletions package.json
Expand Up @@ -30,19 +30,19 @@
"check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\" --no-progress --show-context --show-suggestions",
"clean": "lerna clean -y && nx run-many --target=clean",
"format": "prettier --write .",
"generate-contributors": "yarn tsx ./tools/generate-contributors.ts",
"generate-sponsors": "yarn tsx ./tools/generate-sponsors.ts",
"generate-website-dts": "yarn tsx ./tools/generate-website-dts.ts",
"generate-contributors": "tsx ./packages/repo-tools/generate-contributors.ts",
"generate-sponsors": "tsx ./packages/repo-tools/generate-sponsors.ts",
"generate-website-dts": "tsx ./packages/repo-tools/generate-website-dts.ts",
"generate-lib": "nx generate-lib @typescript-eslint/scope-manager",
"lint-fix": "eslint . --fix",
"lint-fix": "yarn lint --fix",
"lint-markdown-fix": "yarn lint-markdown --fix",
"lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
"lint": "nx run-many --target=lint --parallel",
"postinstall": "yarn tsx ./tools/postinstall.ts",
"postinstall": "tsx ./packages/repo-tools/postinstall.ts",
bradzacher marked this conversation as resolved.
Show resolved Hide resolved
"pre-commit": "yarn lint-staged",
"start": "nx run website:start",
"test": "nx run-many --target=test --parallel",
"test-integration": "yarn jest -c ./tests/integration/jest.config.js",
"test": "nx run-many --target=test --parallel --exclude repo-tests",
"test-integration": "nx run integration-tests:test",
"typecheck": "nx run-many --target=typecheck --parallel"
},
"engines": {
Expand All @@ -68,7 +68,6 @@
"@types/jest-specific-snapshot": "^0.5.5",
"@types/lodash": "^4.14.182",
"@types/marked": "^4.0.3",
"@types/ncp": "^2.0.5",
"@types/node": "^18.11.9",
"@types/prettier": "^2.6.0",
"@types/rimraf": "^3.0.2",
Expand All @@ -86,7 +85,6 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.0.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"execa": "5.1.1",
"glob": "^8.0.1",
"husky": "^8.0.1",
"jest": "^29.0.3",
Expand All @@ -97,14 +95,13 @@
"lint-staged": "^13.0.0",
"make-dir": "^3.1.0",
"markdownlint-cli": "^0.33.0",
"ncp": "^2.0.0",
"nx": "15.6.3",
"patch-package": "^6.4.7",
"prettier": "2.8.1",
"prettier": "^2.8.4",
"pretty-format": "^29.0.3",
"rimraf": "^4.0.0",
"tmp": "^0.2.1",
"ts-node": "10.7.0",
"ts-node": "^10.7.0",
"tslint": "^6.1.3",
"tsx": "^3.12.1",
"typescript": ">=4.2.4 <5.0.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/ast-spec/project.json
Expand Up @@ -16,7 +16,8 @@
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/ast-spec/**/*.ts"]
"lintFilePatterns": ["packages/ast-spec/**/*.{mts,cts,ts,tsx}"],
"ignorePath": ".eslintignore"
}
}
}
Expand Down
@@ -1,3 +1,3 @@
class Foo {
accessor 1 = 2;
accessor [1 + 1] = 2;
}
Expand Up @@ -11,17 +11,38 @@ Program {
body: Array [
AccessorProperty {
type: "AccessorProperty",
computed: false,
computed: true,
declare: false,
key: Literal {
type: "Literal",
raw: "1",
value: 1,
key: BinaryExpression {
type: "BinaryExpression",
left: Literal {
type: "Literal",
raw: "1",
value: 1,

range: [24, 25],
loc: {
start: { column: 12, line: 2 },
end: { column: 13, line: 2 },
},
},
operator: "+",
right: Literal {
type: "Literal",
raw: "1",
value: 1,

range: [28, 29],
loc: {
start: { column: 16, line: 2 },
end: { column: 17, line: 2 },
},
},

range: [23, 24],
range: [24, 29],
loc: {
start: { column: 11, line: 2 },
end: { column: 12, line: 2 },
start: { column: 12, line: 2 },
end: { column: 17, line: 2 },
},
},
override: false,
Expand All @@ -31,22 +52,22 @@ Program {
raw: "2",
value: 2,

range: [27, 28],
range: [33, 34],
loc: {
start: { column: 15, line: 2 },
end: { column: 16, line: 2 },
start: { column: 21, line: 2 },
end: { column: 22, line: 2 },
},
},

range: [14, 29],
range: [14, 35],
loc: {
start: { column: 2, line: 2 },
end: { column: 17, line: 2 },
end: { column: 23, line: 2 },
},
},
],

range: [10, 31],
range: [10, 37],
loc: {
start: { column: 10, line: 1 },
end: { column: 1, line: 3 },
Expand All @@ -64,7 +85,7 @@ Program {
},
superClass: null,

range: [0, 31],
range: [0, 37],
loc: {
start: { column: 0, line: 1 },
end: { column: 1, line: 3 },
Expand All @@ -73,7 +94,7 @@ Program {
],
sourceType: "script",

range: [0, 32],
range: [0, 38],
loc: {
start: { column: 0, line: 1 },
end: { column: 0, line: 4 },
Expand Down