-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
enhancementNew feature or requestNew feature or requesttriageWaiting for team members to take a lookWaiting for team members to take a look
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
Relevant Package
parser
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
I expect that these should throw (when validating parser options):
import tseslint from 'typescript-eslint';
export default tseslint.config(
tseslint.configs.strictTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: 'not/an/absolute/path',
}
}
}
);
(or tsconfigRootDir: 42
, or tsconfigRootDir: '.'
).
In other words, I think the following...
typescript-eslint/packages/typescript-estree/src/parseSettings/createParseSettings.ts
Lines 47 to 56 in 7126c3a
export function createParseSettings( | |
code: string | ts.SourceFile, | |
tsestreeOptions: Partial<TSESTreeOptions> = {}, | |
): MutableParseSettings { | |
const codeFullText = enforceCodeString(code); | |
const singleRun = inferSingleRun(tsestreeOptions); | |
const tsconfigRootDir = | |
typeof tsestreeOptions.tsconfigRootDir === 'string' | |
? tsestreeOptions.tsconfigRootDir | |
: getInferredTSConfigRootDir(); |
...should have (roughly)
assert(
tsestreeOptions.tsconfigRootDir == null ||
(typeof tsestreeOptions.tsconfigRootDir === "string" &&
path.isAbsolute(tsestreeOptions.tsconfigRootDir)),
);
Additional Info
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesttriageWaiting for team members to take a lookWaiting for team members to take a look