-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tests-jest | Converts tests to jest * tests-jest | Type fixes * tests-jest | Fixes cli test * ts-strict | Adds file ignoring with @ts-strict-ignore comment * ts-strict | Adds insert ignore comment functionality * ts-strict | Unifies cli and plugin logic * ts-strict | Adds file updating * ts-strict | Unifies function declarations * ts-strict | 2.0 init * ts-strict | Readme update 1.0 * ts-strict | Readme update migration part * ts-strict | Updated user messages * ts-strict | Fixes test variable names * ts-strict | Fixes type error * ts-strict | Updates changelog * ts-strict | Removes updateComments tests for now * Refactor * Bugfixes * comments refactor * Adds pluralization and cli unit tests * Adds process exit expects to tsc-strict root files * Fixes failing tests * e2e fixture refactor * typo fixes * typo fixes * cli structure refactor * final test addition * Fixes e2e test name * fixes bin scripts paths Co-authored-by: Kamil Krysiak <[email protected]>
- Loading branch information
Showing
69 changed files
with
5,539 additions
and
17,352 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
dist | ||
.idea |
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
File renamed without changes.
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,4 @@ | ||
// @ts-strict-ignore | ||
const text: string = null; | ||
|
||
export {}; |
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 @@ | ||
const text: string = null; | ||
|
||
export {}; |
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,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"module": "commonjs", | ||
"lib": ["es2018"], | ||
"baseUrl": "./", | ||
"outDir": "./dist", | ||
"strict": false, | ||
"esModuleInterop": true, | ||
"noImplicitAny": true, | ||
"plugins": [ | ||
{ | ||
"name": "../../dist/plugin" | ||
} | ||
] | ||
} | ||
} |
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 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
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 @@ | ||
const text: string = null; | ||
|
||
export {}; |
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 @@ | ||
const text: string = null; | ||
|
||
export {}; |
4 changes: 4 additions & 0 deletions
4
e2e/fixtures/path-config/excluded/excludedWithStrictComment.ts
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,4 @@ | ||
// @ts-strict | ||
const text: string = null; | ||
|
||
export {}; |
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 @@ | ||
const text: string = null; | ||
|
||
export {}; |
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 @@ | ||
const text: string = null; | ||
|
||
export {}; |
File renamed without changes.
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 @@ | ||
import path from 'path'; | ||
|
||
export const fixtureWithDefaultConfig = { | ||
projectPath: path.resolve(__dirname, 'default-config'), | ||
filePaths: { | ||
strict: 'strict.ts', | ||
ignored: 'ignored.ts', | ||
}, | ||
}; | ||
|
||
export const fixtureWithPathConfig = { | ||
projectPath: path.resolve(__dirname, 'path-config'), | ||
filePaths: { | ||
included: 'included/included.ts', | ||
included2: 'included/included2.ts', | ||
excluded: 'excluded/excluded.ts', | ||
excluded2: 'excluded/excluded2.ts', | ||
excludedWithStrictComment: 'excluded/excludedWithStrictComment.ts', | ||
}, | ||
}; |
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,15 @@ | ||
import { getMultipleDiagnostics } from './utils/getMultipleDiagnostics'; | ||
import { fixtureWithDefaultConfig } from '../fixtures/paths'; | ||
|
||
it('should show errors only on file with strict comment', async () => { | ||
// given | ||
const { projectPath, filePaths } = fixtureWithDefaultConfig; | ||
const fileList = [filePaths.strict, filePaths.ignored]; | ||
|
||
// when | ||
const diagnostics = await getMultipleDiagnostics(projectPath, fileList); | ||
|
||
// then | ||
expect(diagnostics[0]).toHaveLength(1); | ||
expect(diagnostics[1]).toHaveLength(0); | ||
}); |
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,48 @@ | ||
import { getDiagnostics } from './utils/getDiagnostics'; | ||
import { fixtureWithDefaultConfig, fixtureWithPathConfig } from '../fixtures/paths'; | ||
|
||
describe('single file diagnostics', () => { | ||
it('should enable strict mode by default in project without config', async () => { | ||
// given | ||
const { projectPath, filePaths } = fixtureWithDefaultConfig; | ||
|
||
// when | ||
const diagnostics = await getDiagnostics(projectPath, filePaths.strict); | ||
|
||
// then | ||
expect(diagnostics).toHaveLength(1); | ||
}); | ||
|
||
it('should not enable strict mode in ignored file', async () => { | ||
// given | ||
const { projectPath, filePaths } = fixtureWithDefaultConfig; | ||
|
||
// when | ||
const diagnostics = await getDiagnostics(projectPath, filePaths.ignored); | ||
|
||
// then | ||
expect(diagnostics).toHaveLength(0); | ||
}); | ||
|
||
it('should not enable strict mode when file is not on path', async () => { | ||
// given | ||
const { projectPath, filePaths } = fixtureWithPathConfig; | ||
|
||
// when | ||
const diagnostics = await getDiagnostics(projectPath, filePaths.excluded); | ||
|
||
// then | ||
expect(diagnostics).toHaveLength(0); | ||
}); | ||
|
||
it('should enable strict mode when file is not on path and contains strict comment', async () => { | ||
// given | ||
const { projectPath, filePaths } = fixtureWithPathConfig; | ||
|
||
// when | ||
const diagnostics = await getDiagnostics(projectPath, filePaths.excludedWithStrictComment); | ||
|
||
// then | ||
expect(diagnostics).toHaveLength(1); | ||
}); | ||
}); |
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
25 changes: 12 additions & 13 deletions
25
test/plugin/getMultipleDiagnostics.ts → e2e/plugin/utils/getMultipleDiagnostics.ts
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
Oops, something went wrong.