SugarSS support from PR 1967 (#2219)

* sugarss support + bonus naming Sass correctly
* cleanup + alphabetic ordering
This commit is contained in:
Niclas Åhdén 2019-01-27 12:42:11 +01:00 committed by w0rp
parent f03370e183
commit e46c17e8ef
7 changed files with 92 additions and 5 deletions

View File

@ -185,13 +185,14 @@ formatting.
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo), [solargraph](https://solargraph.org), [standardrb](https://github.com/testdouble/standard) |
| Rust | [cargo](https://github.com/rust-lang/cargo) !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
| Sass | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
| Scala | [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html), [sbtserver](https://www.scala-sbt.org/1.x/docs/sbt-server.html), [scalac](http://scala-lang.org), [scalafmt](https://scalameta.org/scalafmt/), [scalastyle](http://www.scalastyle.org)|
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
| SML | [smlnj](http://www.smlnj.org/) |
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
| SugarSS | [stylelint](https://github.com/stylelint/stylelint) |
| SQL | [sqlint](https://github.com/purcell/sqlint), [sqlfmt](https://github.com/jackc/sqlfmt) |
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |

View File

@ -0,0 +1,21 @@
" Author: toastal <toastal@protonmail.com>
" Description: `stylelint` linter for SugarSS files
call ale#Set('sugarss_stylelint_executable', 'stylelint')
call ale#Set('sugarss_stylelint_options', '')
call ale#Set('sugarss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#sugarss#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options'))
\ . ' --syntax=sugarss'
\ . ' --stdin-filename %s'
endfunction
call ale#linter#Define('sugarss', {
\ 'name': 'stylelint',
\ 'executable_callback': ale#node#FindExecutableFunc('sugarss_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ]),
\ 'command_callback': 'ale_linters#sugarss#stylelint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
\})

View File

@ -122,7 +122,7 @@ let s:default_registry = {
\ },
\ 'stylelint': {
\ 'function': 'ale#fixers#stylelint#Fix',
\ 'suggested_filetypes': ['css', 'sass', 'scss', 'stylus'],
\ 'suggested_filetypes': ['css', 'sass', 'scss', 'sugarss', 'stylus'],
\ 'description': 'Fix stylesheet files using stylelint --fix.',
\ },
\ 'swiftformat': {

View File

@ -1,5 +1,5 @@
===============================================================================
ALE SASS Integration *ale-sass-options*
ALE Sass Integration *ale-sass-options*
===============================================================================

31
doc/ale-sugarss.txt Normal file
View File

@ -0,0 +1,31 @@
===============================================================================
ALE SugarSS Integration *ale-sugarss-options*
===============================================================================
stylelint *ale-sugarss-stylelint*
g:ale_sugarss_stylelint_executable *g:ale_sugarss_stylelint_executable*
*b:ale_sugarss_stylelint_executable*
Type: |String|
Default: `'stylelint'`
See |ale-integrations-local-executables|
g:ale_sugarss_stylelint_options *g:ale_sugarss_stylelint_options*
*b:ale_sugarss_stylelint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to stylelint.
g:ale_sugarss_stylelint_use_global *g:ale_sugarss_stylelint_use_global*
*b:ale_sugarss_stylelint_use_global*
Type: |String|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -324,6 +324,8 @@ CONTENTS *ale-contents*
sqlfmt..............................|ale-sql-sqlfmt|
stylus................................|ale-stylus-options|
stylelint...........................|ale-stylus-stylelint|
sugarss...............................|ale-sugarss-options|
stylelint...........................|ale-sugarss-stylelint|
tcl...................................|ale-tcl-options|
nagelfar............................|ale-tcl-nagelfar|
terraform.............................|ale-terraform-options|
@ -502,13 +504,14 @@ Notes:
* RPM spec: `rpmlint`
* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`, `solargraph`, `standardrb`
* Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt`
* SASS: `sass-lint`, `stylelint`
* Sass: `sass-lint`, `stylelint`
* SCSS: `prettier`, `sass-lint`, `scss-lint`, `stylelint`
* Scala: `fsc`, `sbtserver`, `scalac`, `scalafmt`, `scalastyle`
* Slim: `slim-lint`
* SML: `smlnj`
* Solidity: `solhint`, `solium`
* Stylus: `stylelint`
* SugarSS: `stylelint`
* SQL: `sqlint`, `sqlfmt`
* Swift: `swiftlint`, `swiftformat`
* Tcl: `nagelfar`!!
@ -2785,7 +2788,7 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
and have been checked at least once.
Temporary files in directories used for Vim
temporary files with `tempname()` will be asssumed
temporary files with `tempname()` will be assumed
to be the buffer being checked, unless the `bufnr`
key is also set with a valid number for some other
buffer.

View File

@ -0,0 +1,31 @@
Before:
call ale#assert#SetUpLinterTest('sugarss', 'stylelint')
unlet! b:executable
After:
unlet! b:executable
call ale#assert#TearDownLinterTest()
Execute(node_modules directories should be discovered):
call ale#test#SetFilename('stylelint_paths/nested/testfile.sss')
let b:executable = ale#path#Simplify(
\ g:dir
\ . '/stylelint_paths/node_modules/.bin/stylelint'
\)
AssertLinter b:executable, ale#Escape(b:executable) . ' --syntax=sugarss --stdin-filename %s'
Execute(The global override should work):
let b:ale_sugarss_stylelint_executable = 'foobar'
let b:ale_sugarss_stylelint_use_global = 1
call ale#test#SetFilename('stylelint_paths/nested/testfile.sss')
AssertLinter 'foobar', ale#Escape('foobar') . ' --syntax=sugarss --stdin-filename %s'
Execute(Extra options should be configurable):
let b:ale_sugarss_stylelint_options = '--configFile ''/absolute/path/to/file'''
AssertLinter 'stylelint',
\ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --syntax=sugarss --stdin-filename %s'