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

add support to tslint.json linterOptions.exclude #377

Merged
merged 2 commits into from
Feb 6, 2020

Conversation

devpaul
Copy link
Member

@devpaul devpaul commented Feb 6, 2020

Type: feature

The following has been addressed in the PR:

  • There is a related issue
  • All code has been formatted with prettier
  • Unit or Functional tests are included in the PR
  • schema.json has been updated appopriately

Description:

This adds support to dojo's tslint-loader configuration to support tslint's linterOptions.exclude.

It turns out that tslint-loader doesn't support this (wbuchwalter/tslint-loader#104). So to implement this we're using webpack's exclude option to explicitly avoid linting files in the tslint.json exclude and using globby to generate a list of absolute paths to files to exclude.

Resolves #85

@codecov
Copy link

codecov bot commented Feb 6, 2020

Codecov Report

Merging #377 into master will increase coverage by 0.29%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #377      +/-   ##
==========================================
+ Coverage   48.92%   49.21%   +0.29%     
==========================================
  Files          10       10              
  Lines         695      703       +8     
  Branches      199      205       +6     
==========================================
+ Hits          340      346       +6     
- Misses        355      357       +2
Impacted Files Coverage Δ
src/base.config.ts 20.85% <66.66%> (+1.2%) ⬆️
src/main.ts 89.18% <0%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd7d1b4...9cbc7cb. Read the comment docs.

@@ -44,6 +45,12 @@ export const packageName = packageJson.name || '';

const tsLintPath = path.join(basePath, 'tslint.json');
const tsLint = existsSync(tsLintPath) ? require(tsLintPath) : false;
const tsLintExcludes =
Copy link
Member

Choose a reason for hiding this comment

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

I find this a little hard to parse, perhaps we can make it clearer using an if block?

let tsLintExcludeFiles = [];
if (tsLint && tsLint.linterOptions && tsLint.linterOptions.excludes) {
    const { linterOptions: { exclude } } = tsLint;
    tsLintExcludeFiles = globby.sync(exclude).map((file) => path.resolve(file)));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tslint configuration does not accept linterOptions - exclude
2 participants