matype / stylefmt

stylefmt is a tool that automatically formats stylesheets.
Other
2.1k stars 89 forks source link

Add support for .stylelintignore or other ability to ignore files #222

Closed dcro closed 7 years ago

dcro commented 7 years ago

stylefmt does not currently support stylelint's .stylelintignore file that specifies which files should be excluded from linting.

It would be great to have the ability to ignore some files when doing a recursive fix, either by automatically parsing any existing .stylelintignore file or by supporting a .stylefmtignore file.

gucong3000 commented 7 years ago

We can support .stylelintignore base #221

@morishitter what do you think?

dcro commented 7 years ago

@gucong3000 I've installed that fork and ran a test but it also modified files which stylelint ignores.

My directory setup is similar to the following:

root
└─ .stylelintrc
└─ .stylelintignore
└─ assets/
   └─ sass/
       └─ file1.scss
       └─ file2.scss
       └─ third-party/
          └─ third-party-1.scss
          └─ third-party-2.scss

.stylelintignore is configured to ignore everything under assets/sass/third-party as those files come from a third-party provider and I need to keep them unchanged to be able to easily update them an track the changes each update introduces.

My .stylelintignore file reads:

# .stylelintignore
assets/sass/third-party

To test this, I've ran the following in the root:

# Stylelint command works correctly, ignores assets/sass/third-party directory
node_modules/stylelint/dist/cli.js 'assets/sass/**/*.scss'

# Stylefmt command does not ignore files in the assets/sass/third-party directory
node_modules/stylefmt/bin/cli.js -R 'assets/sass/'
gucong3000 commented 7 years ago

@dcro Wait a minute, I'll create a new branch.

gucong3000 commented 7 years ago

@dcro try this branch:

npm i gucong3000/stylefmt#ignore_support --save-dev
dcro commented 7 years ago

This latest branch works great, it ignored all the files it was supposed to and it processed the rest.

gucong3000 commented 7 years ago

My wife will have a baby tomorrow, I will come back a month later.

gucong3000 commented 7 years ago

Support in PR #231

gucong3000 commented 7 years ago

@dcro #231 was merged, Please test your project.

npm i morishitter/stylefmt --save-dev
dcro commented 7 years ago

This seems to run great on the latest version (5.0.2). Thank you for all your help!