Giter Site home page Giter Site logo

editorconfig-checker / editorconfig-checker.javascript Goto Github PK

View Code? Open in Web Editor NEW
71.0 71.0 10.0 4.81 MB

A tool to verify that your files are in harmony with your .editorconfig

Home Page: https://editorconfig-checker.github.io/

License: MIT License

TypeScript 80.26% JavaScript 19.74%
clean-architecture code-quality codequality editorconfig editorconfig-checker linting

editorconfig-checker.javascript's Introduction

editorconfig-checker

Buy Me A Coffee

ci codecov Hits-of-Code Go Report Card

Logo

  1. What?
  2. Quickstart
  3. Installation
  4. Usage
  5. Configuration
  6. Excluding
    1. Excluding Lines
    2. Excluding Blocks
    3. Excluding Files
      1. Inline
      2. Default Excludes
      3. Manually Excluding
        1. via configuration
        2. via arguments
        3. Generally
  7. Docker
  8. Continuous Integration
  9. Support

What?

Example Screenshot

This is a tool to check if your files consider your .editorconfig rules. Most tools—like linters, for example—only test one filetype and need an extra configuration. This tool only needs your .editorconfig to check all files.

If you don't know about editorconfig already you can read about it here: editorconfig.org.

Currently implemented editorconfig features are:

  • end_of_line
  • insert_final_newline
  • trim_trailing_whitespace
  • indent_style
  • indent_size
  • max_line_length

Unsupported features are:

  • charset

Quickstart

VERSION="v3.0.3"
OS="linux"
ARCH="amd64"
curl -O -L -C - https://github.com/editorconfig-checker/editorconfig-checker/releases/download/$VERSION/ec-$OS-$ARCH.tar.gz && \
tar xzf ec-$OS-$ARCH.tar.gz && \
./bin/ec-$OS-$ARCH

Installation

Grab a binary from the release page.

If you have go installed you can run go get github.com/editorconfig-checker/editorconfig-checker/v3 and run make build inside the project folder. This will place a binary called ec into the bin directory.

If you are using Arch Linux, you can use pacman to install from extra repository:

pacman -S editorconfig-checker

Also, development (VCS) package is available in the AUR:

# <favourite-aur-helper> <install-command> editorconfig-checker-git

# i.e.
paru -S editorconfig-checker-git

If go 1.16 or greater is installed, you can also install it globally via go install:

go install github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@latest

Usage

USAGE:
  -config string
        config
  -debug
        print debugging information
  -disable-end-of-line
        disables the trailing whitespace check
  -disable-indent-size
        disables only the indent-size check
  -disable-indentation
        disables the indentation check
  -disable-insert-final-newline
        disables the final newline check
  -disable-trim-trailing-whitespace
        disables the trailing whitespace check
  -dry-run
        show which files would be checked
  -exclude string
        a regex which files should be excluded from checking - needs to be a valid regular expression
  -format
        specifies the output format, see "Formats" below for more information
  -h    print the help
  -help
        print the help
  -ignore-defaults
        ignore default excludes
  -init
        creates an initial configuration
  -no-color
        dont print colors
  -v    print debugging information
  -verbose
        print debugging information
  -version
        print the version number

If you run this tool from a repository root it will check all files which are added to the git repository and are text files. If the tool isn't able to determine a file type it will be added to be checked too.

If you run this tool from a normal directory it will check all files which are text files. If the tool isn't able to determine a file type it will be added to be checked too.

Formats

The following output formats are supported:

  • default: Plain text, human readable output.
  • gcc: GCC compatible output. Useful for editors that support compiling and showing syntax errors. ::: :

Configuration

The configuration is done via arguments or an .ecrc file.

A sample .ecrc file can look like this and will be used from your current working directory if not specified via the --config argument:

{
  "Verbose": false,
  "Debug": false,
  "IgnoreDefaults": false,
  "SpacesAftertabs": false,
  "NoColor": false,
  "Exclude": [],
  "AllowedContentTypes": [],
  "PassedFiles": [],
  "Disable": {
    "EndOfLine": false,
    "Indentation": false,
    "IndentSize": false,
    "InsertFinalNewline": false,
    "TrimTrailingWhitespace": false,
    "MaxLineLength": false
  }
}

You can set any of the options under the "Disable" section to true to disable those particular checks.

You could also specify command line arguments and they will get merged with the configuration file, the command line arguments have a higher precedence than the configuration.

You can create a configuration with the init-flag. If you specify an config-path it will be created there.

By default the allowed_content_types are:

  1. text/ (matches text/plain, text/html, etc.)
  2. application/ecmascript
  3. application/json
  4. application/x-ndjson
  5. application/xml
  6. +json (matches application/geo+json, etc.)
  7. +xml (matches application/rss+xml, etc.)
  8. application/octet-stream

application/octet-stream is needed as a fallback when no content type could be determined. You can add additional accepted content types with the allowed_content_types key. But the default ones don't get removed.

Excluding

Excluding Lines

You can exclude single lines inline. To do that you need a comment on that line that says: editorconfig-checker-disable-line.

const myTemplateString = `
  first line
     wrongly indended line because it needs to be` // editorconfig-checker-disable-line

Excluding Blocks

To temporarily disable all checks, add a comment containing editorconfig-checker-disable. Re-enable with a comment containing editorconfig-checker-enable

// editorconfig-checker-disable
const myTemplateString = `
  first line
     wrongly indended line because it needs to be
`
// editorconfig-checker-enable

Excluding Files

Inline

If you want to exclude a file inline you need a comment on the first line of the file that contains: editorconfig-checker-disable-file

-- editorconfig-checker-disable-file
add :: Int -> Int -> Int
add x y =
  let result = x + y -- falsy indentation would not report
  in result -- falsy indentation would not report

Default Excludes

If you don't pass the ignore-defaults flag to the binary these files are excluded automatically:

"^\\.yarn/",
"^yarn\\.lock$",
"^package-lock\\.json$",
"^composer\\.lock$",
"^Cargo\\.lock$",
"^\\.pnp\\.cjs$",
"^\\.pnp\\.js$",
"^\\.pnp\\.loader\\.mjs$",
"\\.snap$",
"\\.otf$",
"\\.woff$",
"\\.woff2$",
"\\.eot$",
"\\.ttf$",
"\\.gif$",
"\\.png$",
"\\.jpg$",
"\\.jpeg$",
"\\.webp$",
"\\.avif",
"\\.pnm",
"\\.pbm",
"\\.pgm",
"\\.ppm",
"\\.mp4$",
"\\.wmv$",
"\\.svg$",
"\\.ico$",
"\\.bak$",
"\\.bin$",
"\\.pdf$",
"\\.zip$",
"\\.gz$",
"\\.tar$",
"\\.7z$",
"\\.bz2$",
"\\.log$",
"\\.patch$",
"\\.css\\.map$",
"\\.js\\.map$",
"min\\.css$",
"min\\.js$"

Manually Excluding

via configuration

In your .ecrc file you can exclude files with the "exclude" key which takes an array of regular expressions. This will get merged with the default excludes (if not ignored). You should remember to escape your regular expressions correctly. ;)

An .ecrc which would ignore all test files and all markdown files can look like this:

{
  "Verbose": false,
  "IgnoreDefaults": false,
  "Exclude": ["testfiles", "\\.md$"],
  "SpacesAfterTabs": false,
  "Disable": {
    "EndOfLine": false,
    "Indentation": false,
    "IndentSize": false,
    "InsertFinalNewline": false,
    "TrimTrailingWhitespace": false,
    "MaxLineLength": false
  }
}
via arguments

If you want to play around how the tool would behave you can also pass the --exclude argument to the binary. This will accept a regular expression as well. If you use this argument the default excludes as well as the excludes from the .ecrc file will merged together.

For example: ec --exclude node_modules

Generally

Every exclude option is merged together.

If you want to see which files the tool would check without checking them you can pass the --dry-run flag.

Note that while --dry-run outputs absolute paths, a regular expression matches on relative paths from where the ec command is used.

Docker

You are able to run this tool inside a Docker container. To do this you need to have Docker installed and run this command in your repository root which you want to check: docker run --rm --volume=$PWD:/check mstruebing/editorconfig-checker

Dockerhub: mstruebing/editorconfig-checker

Continuous Integration

Mega-Linter

Instead of installing and configuring editorconfig-checker and all other linters in your project CI workflows (GitHub Actions & others), you can use Mega-Linter which does all that for you with a single assisted installation.

Mega-Linter embeds editorconfig-checker by default in all its flavors, meaning that it will be run at each commit or Pull Request to detect any issue related to .editorconfig.

If you want to use only editorconfig-checker and not the 70+ other linters, you can use the following .mega-linter.yml configuration file:

ENABLE:
  - EDITORCONFIG

GitLab CI

The ss-open/ci/recipes project offers a ready to use lint job integrating editorconfig-checker.

Support

If you have any questions, suggestions, need a wrapper for a programming language or just want to chat join #editorconfig-checker on freenode(IRC). If you don't have an IRC-client set up you can use the freenode webchat.

editorconfig-checker.javascript's People

Contributors

bufferoverflow avatar chalkygames123 avatar dependabot-preview[bot] avatar dependabot[bot] avatar fgreinacher avatar greenkeeper[bot] avatar lgtm-migrator avatar mondeja avatar mstruebing avatar ndxbn avatar nejch avatar ruxandrafed avatar septs avatar theoludwig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

editorconfig-checker.javascript's Issues

Works incorrectly with paths

Hello! Please help me figure out how to exclude several folders from the scan.

documentation says to use valid regular expressions
image

with one folder - exception works
image

but if I use a valid regular expression - the plugin doesn't work
image
path not found as the result
image

please explain where I went wrong and how to set an exception for a group of certain files or folders.

Disable rules inline

It would be awesome to be able to disable certain rules through inline comments.

Different comment's syntax is quite challenging, though it would be awesome.

Invalidate latest

If we have downloaded the latest version and a new one is released, we currently do not fetch the new version but rather use the already downloaded one as latest.

We need to find a way to be able either periodically check in an specific interval since latest was last touched or before every run if there is a new release.

That means we need to store which version is latest.
There are multiple ways, possible via symlinks or to remove the latest terminology.

Do you have any thoughts on this @septs ?

Apple Silicon support

❯ npx --verbose editorconfig-checker -vvv -verbose -ignore-defaults -exclude "min\\.js$"
npm verb cli [
npm verb cli   '/opt/homebrew/Cellar/node/16.6.1/bin/node',
npm verb cli   '/opt/homebrew/lib/node_modules/npm/bin/npm-cli.js',
npm verb cli   'exec',
npm verb cli   '--loglevel',
npm verb cli   'verbose',
npm verb cli   '--',
npm verb cli   'editorconfig-checker',
npm verb cli   '-vvv',
npm verb cli   '-verbose',
npm verb cli   '-ignore-defaults',
npm verb cli   '-exclude',
npm verb cli   'min\\.js$'
npm verb cli ]
npm info using [email protected]
npm info using [email protected]
npm timing npm:load:whichnode Completed in 0ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/opt/homebrew/lib/node_modules/npm/npmrc Completed in 0ms
npm timing config:load:builtin Completed in 0ms
npm timing config:load:cli Completed in 1ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:/redacted/.npmrc Completed in 0ms
npm timing config:load:project Completed in 0ms
npm timing config:load:file:/Users/anatoly/.npmrc Completed in 0ms
npm timing config:load:user Completed in 0ms
npm timing config:load:file:/opt/homebrew/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 0ms
npm timing config:load Completed in 4ms
npm timing npm:load:configload Completed in 4ms
npm timing npm:load:setTitle Completed in 3ms
npm timing npm:load:setupLog Completed in 0ms
npm timing config:load:flatten Completed in 1ms
npm timing npm:load:cleanupLog Completed in 1ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load:projectScope Completed in 0ms
npm timing npm:load Completed in 12ms
ERROR: Error: TAR_BAD_ARCHIVE: Unrecognized archive format
    at Unpack.warn (/redacted/node_modules/tar/lib/warn-mixin.js:19:40)
    at Unpack.warn (/redacted/node_modules/tar/lib/unpack.js:189:18)
    at Unpack.<anonymous> (/redacted/node_modules/tar/lib/parse.js:81:14)
    at Unpack.emit (node:events:406:35)
    at Unpack.[emit] (/redacted/node_modules/tar/lib/parse.js:285:12)
    at Unpack.[maybeEnd] (/redacted/node_modules/tar/lib/parse.js:401:17)
    at Unpack.[consumeChunk] (/redacted/node_modules/tar/lib/parse.js:432:21)
    at Unpack.write (/redacted/node_modules/tar/lib/parse.js:364:25)
    at Unpack.end (/Users/anatoly/redacted/node_modules/tar/lib/parse.js:477:14)
    at Yallist.<anonymous> (/redacted/node_modules/minipass/index.js:396:18) {
  recoverable: false,
  file: '/redacted/node_modules/editorconfig-checker/dist/../ec.tar.gz',
  cwd: '/redacted/node_modules/editorconfig-checker',
  code: 'TAR_BAD_ARCHIVE',
  tarCode: 'TAR_BAD_ARCHIVE'
}
npm timing command:exec Completed in 1086ms
npm verb exit 0
npm timing npm Completed in 1170ms
npm info ok 

redacted on  develop [!] via  v16.6.1 
❯ file /redacted/node_modules/editorconfig-checker/dist/../ec.tar.gz                                                  
/redacted/node_modules/editorconfig-checker/dist/../ec.tar.gz: ASCII text, with no line terminators

redacted on  develop [!] via  v16.6.1 
❯ cat /redacted/node_modules/editorconfig-checker/dist/../ec.tar.gz               
Not Found%                                                                                                                                                                     

Disable whole file

It should be possible to disable a whole file from being checked.
Maybe rule based

e.g.

// editorconfig-disable-file

//code 
...

Duplicate errors

Hi!

For some reason every error is duplicated in both declarations and total counts.

image

Do not rely on git output for excludes

  1. Clone this project.
  2. Check out the master branch. Currently at fa7b7d0796cfe2e8a0e61596beb4cbebeb53a146.
  3. $ npm install.
  4. $ npm run compile-commonjs
  5. $ npx editorconfig-checker --verbose --dry-run.

I expect all the *.js files at the root to be checked. They don't seem to be. Here's the output:

Exclude Regexp: yarn\.lock$|package-lock\.json|composer\.lock$|\.snap$|\.otf$|\.woff$|\.woff2$|\.eot$|\.ttf$|\.gif$|\.png$|\.jpg$|\.jpeg$|\.mp4$|\.wmv$|\.svg$|\.ico$|\.bak$|\.bin$|\.pdf$|\.zip$|\.gz$|\.tar$|\.7z$|\.bz2$|\.log$|\.css\.map$|\.js\.map$|min\.css$|min\.js$

Add .editorconfig to be checked

Add .eslintrc.js to be checked
Add .gitignore to be checked
Add .node-version to be checked
Add .nvmrc to be checked
Add .travis.yml to be checked
Add .vscode/settings.json to be checked
Add LICENSE to be checked

Add README.md to be checked
Add browserstack-karma.js to be checked

Add dist/h.js to be checked
Add dist/h.min.js to be checked

Add dist/h.min.js.map to be checked
Add dist/snabbdom-attributes.js to be checked

Add dist/snabbdom-attributes.min.js to be checked

Add dist/snabbdom-attributes.min.js.map to be checked
Add dist/snabbdom-class.js to be checked

Add dist/snabbdom-class.min.js to be checked
Add dist/snabbdom-class.min.js.map to be checked

Add dist/snabbdom-dataset.js to be checked
Add dist/snabbdom-eventlisteners.js to be checked

Add dist/snabbdom-eventlisteners.min.js to be checked

Add dist/snabbdom-eventlisteners.min.js.map to be checked
Add dist/snabbdom-patch.js to be checked

Add dist/snabbdom-patch.min.js to be checked
Add dist/snabbdom-patch.min.js.map to be checked

Add dist/snabbdom-props.js to be checked

Add dist/snabbdom-props.min.js to be checked
Add dist/snabbdom-props.min.js.map to be checked

Add dist/snabbdom-style.js to be checked
Add dist/snabbdom-style.min.js to be checked

Add dist/snabbdom-style.min.js.map to be checked
Add dist/snabbdom.js to be checked

Add dist/snabbdom.min.js to be checked

Add dist/snabbdom.min.js.map to be checked
Add dist/tovnode.js to be checked

Add dist/tovnode.min.js to be checked
Add dist/tovnode.min.js.map to be checked

Add examples/carousel-svg/README.md to be checked

Add examples/carousel-svg/build.js to be checked
Add examples/carousel-svg/index.html to be checked

Add examples/carousel-svg/script.js to be checked
Add examples/hero/build.js to be checked

Add examples/hero/index.html to be checked
Add examples/hero/script.js to be checked

Add examples/reorder-animation/build.js to be checked

Add examples/reorder-animation/index.html to be checked
Add examples/reorder-animation/script.js to be checked

Add examples/svg/build.js to be checked
Add examples/svg/index.html to be checked

Add examples/svg/script.js to be checked

Add gulpfile.js to be checked
Add karma.conf.js to be checked

Don't add logo.png to be checked
Add nodenv to be checked

Add package-lock.json to be checked
Add package.json to be checked

Add perf/benchmarks.js to be checked

Add perf/index.html to be checked
Add src/h.ts to be checked

Add src/helpers/attachto.ts to be checked
Add src/hooks.ts to be checked

Add src/htmldomapi.ts to be checked

Add src/is.ts to be checked
Add src/jsx-global.d.ts to be checked

Add src/jsx.ts to be checked

Add src/modules/attributes.ts to be checked
Add src/modules/class.ts to be checked

Add src/modules/dataset.ts to be checked
Add src/modules/eventlisteners.ts to be checked

Add src/modules/hero.ts to be checked

Add src/modules/module.ts to be checked
Add src/modules/props.ts to be checked

Add src/modules/style.ts to be checked
Add src/snabbdom.bundle.ts to be checked

Add src/snabbdom.ts to be checked

Add src/thunk.ts to be checked
Add src/tovnode.ts to be checked

Add src/vnode.ts to be checked

Add test/attachto.js to be checked
Add test/attributes.js to be checked

Add test/core.js to be checked
Add test/dataset.js to be checked

Add test/eventlisteners.js to be checked

Add test/htmldomapi.js to be checked
Add test/jsx.tsx to be checked

Add test/style.js to be checked
Add test/thunk.js to be checked

Add tsconfig.json to be checked
.editorconfig
.eslintrc.js
.gitignore
.node-version
.nvmrc
.travis.yml
.vscode/settings.json
LICENSE
README.md
browserstack-karma.js

dist/h.js
dist/h.min.js
dist/h.min.js.map
dist/snabbdom-attributes.js
dist/snabbdom-attributes.min.js
dist/snabbdom-attributes.min.js.map
dist/snabbdom-class.js
dist/snabbdom-class.min.js
dist/snabbdom-class.min.js.map
dist/snabbdom-dataset.js
dist/snabbdom-eventlisteners.js
dist/snabbdom-eventlisteners.min.js
dist/snabbdom-eventlisteners.min.js.map
dist/snabbdom-patch.js

dist/snabbdom-patch.min.js
dist/snabbdom-patch.min.js.map
dist/snabbdom-props.js
dist/snabbdom-props.min.js
dist/snabbdom-props.min.js.map
dist/snabbdom-style.js
dist/snabbdom-style.min.js
dist/snabbdom-style.min.js.map
dist/snabbdom.js
dist/snabbdom.min.js
dist/snabbdom.min.js.map
dist/tovnode.js
dist/tovnode.min.js
dist/tovnode.min.js.map
examples/carousel-svg/README.md
examples/carousel-svg/build.js

examples/carousel-svg/index.html
examples/carousel-svg/script.js
examples/hero/build.js
examples/hero/index.html
examples/hero/script.js
examples/reorder-animation/build.js
examples/reorder-animation/index.html
examples/reorder-animation/script.js
examples/svg/build.js
examples/svg/index.html
examples/svg/script.js
gulpfile.js
karma.conf.js
nodenv
package-lock.json

package.json
perf/benchmarks.js
perf/index.html
src/h.ts
src/helpers/attachto.ts
src/hooks.ts
src/htmldomapi.ts
src/is.ts
src/jsx-global.d.ts
src/jsx.ts
src/modules/attributes.ts
src/modules/class.ts
src/modules/dataset.ts
src/modules/eventlisteners.ts
src/modules/hero.ts
src/modules/module.ts

src/modules/props.ts
src/modules/style.ts
src/snabbdom.bundle.ts
src/snabbdom.ts
src/thunk.ts
src/tovnode.ts
src/vnode.ts
test/attachto.js
test/attributes.js
test/core.js
test/dataset.js
test/eventlisteners.js
test/htmldomapi.js
test/jsx.tsx

test/style.js
test/thunk.js
tsconfig.json

I don't actually want them checked in the project. They are build artifacts. But I did notice that they theoretically should be checked, according to editorconfig-checker documentation and they're not.

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 12.7.0 to 12.7.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Is it possible to distinguish indentation and alignment?

Here is a part of C++ code:

Screenshot 2019-07-09 at 06 10 32

It uses tabs for the indentation (indent_style = tab in .editorconfig) and uses spaces to align the second line of arguments with the opening bracket.

editorconfig-checker finds an error here:

136: Wrong indentation type(spaces instead of tabs)

Is it possible to avoid it?

Downloading bin file could be fail, should try again in next time

Sometimes, due to network, downloading editorconfig-checker bin file count be fail. It should try download again in next execute time;

[Error: ENOENT: no such file or directory, scandir '/Users/xxx/temp/node_modules/.pnpm/[email protected]/node_modules/editorconfig-checker/bin/latest/bin'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/Users/xxx/.pnpm/[email protected]/node_modules/editorconfig-checker/bin/latest/bin'
}

File-specific properties ignored

Will test some more and report more on this:

indent_size seems to be verified from the [*] section, and not the file-specific properties.
E.g.

[*]
indent_size = 4

[{*.yaml, *.yml}]
indent_size = 2

When a yml file has an indent_size of 2, it will throw an error `Wrong amount of left-padding spaces(want multiple of 8)``

Along with that, I've unset a variable for some filetypes, but it doesn't seem to ignore these properties.
E.g.

[*]
max_line_length = 120

[.editorconfig]
max_line_length = unset

If a line in .editorconfig is longer that 120, it will throw an error Line to long (X instead of 120) (which should also be "too," but I can live with that)

Use upstream binary provided by `EC_VERSION`

When the tool is run without an argument it downloads the latest binary.
If I after that run the tool again with EC_VERSION=2.3.0 it auto picks the already downloaded binary instead of downloading the specified version.

TAR_BAD_ARCHIVE Error with Apple Silicon and Windows

Hi,

currently we have the problem that we can't use this tool reliably in a cross device situation:
On ARM Macs with package version 4.0.2 we get the Error TAR_BAD_ARCHIVE. 4.0.2 works on windows machines tough
Package Version 4.0.0 works on Macs but not on Windows (TAR_BAD_ARCHIVE Error)
If we manually update the CORE_VERSION in index.js of package version 4.0.2 to 2.6.0 we get the TAR_BAD_ARCHIVE Error on Windows but not on Mac.

I believe this is highly related to #316.

Zero IS a multiple of 4!

editorconfig-checker does this weird thing where it often demands that lines be super duper indented, when I really want them at the very left margin.

177) ./yi.hs
	1: Not the right amount of left-padding spaces (found 0 expected multiple of 4 # bash8)
	3: Not the right amount of left-padding spaces (found 0 expected multiple of 4 # bash8)
	5: Not the right amount of left-padding spaces (found 0 expected multiple of 4 # bash8)
	6: Not the right amount of left-padding spaces (found 0 expected multiple of 4 # bash8)
	8: Not the right amount of left-padding spaces (found 0 expected multiple of 4 # bash8)
	10: Not the right amount of left-padding spaces (found 0 expected multiple of 4 # bash8)

Not able to run editorconfig-checker on Win10

On Windows (VM running Windows 10, 10.0.17134) I'm not able to run editorconfig-checker.

I'm using yarn and following package.json:

  "scripts": {
    "editorconfig-checker": "editorconfig-checker"
  }

Result:

events.js:173
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Users\IEUser\dev\dpv\node_modules\editorconfig-checker\dist/../bin/ec-windows-amd64 ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19)
    at onErrorNT (internal/child_process.js:427:16)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)
    at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:804:11)
    at internal/main/run_main_module.js:21:11
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:252:12)
    at onErrorNT (internal/child_process.js:427:16)
    [... lines matching original stack trace ...]
    at internal/main/run_main_module.js:21:11

After renaming node_modules/editorconfig-checker/bin/ec-windows-amd64 to node_modules/editorconfig-checker/bin/ec-windows-amd64.exe everything works fine.

The problem descibed in editorconfig-checker/editorconfig-checker#46

Disable blocks of code

It should be possible to disable blocks of code.
Maybe also rule based

e.g.

// editorconfig-disable

// some code 

// editorconfig-enable

editorconfig-checker should return non-zero if download fails

Using editorconfig-checker within ci should give non-zero if download fails.

node version: lts/erbium -> v12.16.1

$ editorconfig-checker -exclude 'site|node_modules'
(node:124) UnhandledPromiseRejectionWarning: FetchError: request to https://github.com/editorconfig-checker/editorconfig-checker/releases/download//2.1.0/ec-linux-amd64.tar.gz failed, reason: connect ETIMEDOUT 140.82.121.4:443
    at ClientRequest.<anonymous> (/builds/siemens/api/node_modules/node-fetch/lib/index.js:1455:11)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:124) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:124) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 130.04s.

[Bug] : Version 5.1.6 doesn't build correctly

Our pipeline installed the 5.1.6 version automatically. However, the installation via npm doesn't go as expected. We get the following error on the npm install (and on the ‘editorconfig-checker -version' command):

/usr/local/lib/node_modules/editorconfig-checker/dist/index.js:11
/*! formdata-polyfill. MIT License. Jimmy Wärting <[https://jimmy.warting.se/opensource>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

SyntaxError: Unexpected identifier
    at internalCompileFunction (node:internal/vm:76:18)
    at wrapSafe (node:internal/modules/cjs/loader:1283:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49

Node.js v18.20.3

I had to shorten the trace, because it was too long.

5.1.2 no longer supports HTTP proxy

Just to confirm #402 (comment), 5.1.2 no longer downloads the go binary via proxy:

$ yarn lint:editorconfig
yarn run v1.22.19
$ editorconfig-checker docs/*/*.md docs/*.md *.md
Failed to download binary:
HttpError: fetch failed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

(follow-up to #394)

We re-added this earlier this year in #395, so might just need some tweaking.

/cc @theoludwig

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Replaced the old Node.js version in your .nvmrc with the new one

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Switch to Makefile

As Makefiles are way more flexible and clear I think it would be a good idea to switch to Makefile.

Add support to exclude files by path

I'm trying to find out how to exclude a path and its files from validation. This is similar to how the source binary can exclude a path, say node_modules or vendor et al.

I have tried a few combinations, but it does not appear to allow a path to be recognized.

lint index

The index.js file is currently not linted and have to be adjusted to satisfy the linter settings

This would affect all files which are placed directly under the src directory

Builds v5.0.0-5.1.1 include lots of suspicious looking, unnecessary code

Looking at upgrading a project that is using 4.0.2, and I noticed the 5.x releases were out. Trying to find the change log, I noticed that npmjs.com lists a steady increase in file size. Got suspicious, and it looks like the dist includes a ton of stuff that doesn't belong there!

4.0.2 - 19.5kB: 2 small js files plus standard package.json/README/LICENSE/CHANGELOG files
5.0.0 - 782kB: a dist folder with a single 776kB index.js, looks like it has graphql clients, fetch wrappers, lots of other stuff included
5.0.1 - 782kB: similar to 5.0.0
5.1.0 - 3.27MB: dist folder includes 3.17MB index.js, setup-node-sandbox.js, setup-sandbox.js, events.js, bridge.js, 37.index.js, all sorts of strange code in them.
5.1.1 - 3.27MB: similar to 5.1.0

Even if the extra code wasn't suspicious and the actual utility ran fine, I am not willing to introduce 3MB into my repos!

Please investigate what is causing this, clean up the build, and release a version which doesn't look like a security nightmare.

indent rule may change within blocks of code

First thanks for this awesome checker. I just started to play around with it and I enjoy it.

Considering an .editorconfig rc file, like:

indent_size = 2

This will give false positive errors for code snippets like:

/*
 This comment block will cause an error, because it has just 1 space.
 Though it's a valid and intended convention/style.
 */
function foo() {}

Wrapping HTML for readability around multiple lines gives same errors for similar reasons:

<div data-foo="1"
     data-bar="2" >
  <!-- Above will error because indentation is 5 spaces -->
</div>

I quickly looked at the current validation algorithm implemented here:
https://github.com/editorconfig-checker/editorconfig-checker.javascript/blob/master/src/validation/space/space-validator.js

Dealing with blocks, would need some contextual meta data being involved, like start of block (/*, <div), end of block (*/, >), maybe type of block, etc.

Did you find yourself in a situation like this before?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.