Coder Social home page Coder Social logo

eslint-plugin-compat's Introduction

eslint-plugin-compat

Test Financial Contributors on Open Collective NPM version npm Backers on Open Collective Sponsors on Open Collective

Lint the browser compatibility of your code

demo of plugin usage

Setup

1. Install

npm install eslint-plugin-compat

2. Update ESLint Config

.eslintrc.json

{
  "plugins": ["compat"],
  "extends": ["plugin:compat/recommended"],
  "env": {
    "browser": true
  }
  // ...
}

3. Configure Target Browsers

Browser targets are configured using browserslist. You can configure browser targets in your package.json:

package.json

{
  // ...
  "browserslist": ["defaults"]
}

If no configuration is found, browserslist defaults to "> 0.5%, last 2 versions, Firefox ESR, not dead".

See browserslist/browserslist for more details.

Adding Polyfills

Add polyfills to the settings section of your eslint config. Append the name of the object and the property if one exists. Here are some examples:

{
  // ...
  "settings": {
    "polyfills": [
      // Example of marking entire API and all methods and properties as polyfilled
      "Promise",
      // Example of marking specific method of an API as polyfilled
      "WebAssembly.compile",
      // Example of API with no property (i.e. a function)
      "fetch",
      // Example of instance method, must add `.prototype.`
      "Array.prototype.push"
    ]
  }
}

Linting ES APIs (Experimental)

This plugin also supports linting the compatibility of ES APIs in addition to Web APIs. This is an experimental feature and is disabled by default. To enable this feature, add the following to your eslint config:

{
  // ...
  "settings": {
    "lintAllEsApis": true
  }
}

Configuring for Different Environments

Browserslist allows specifying different browser queries for multiple environments. By default, this plugin targets the production browserslist environment. To change this default, set the settings.browserslistOpts.env property in your eslint config:

Example:

A browserslist with multiple environments:

  "browserslist": {
    "production": [
      "> 1%",
      "not dead"
    ],
    "modern": [
      "last 1 chrome version",
      "last 1 firefox version"
    ]
  }

Target modern browserslist environment:

{
  "settings": {
    "browserslistOpts": {
      "env": "modern"
    }
  }
}

Demo

For a minimal demo, see amilajack/eslint-plugin-compat-demo

Inspiration

Toolchains for native platforms, like iOS and Android, have had API linting from the start. It's about time that the web had similar tooling.

This project was inspired by a two hour conversation I had with someone on the experience of web development and if it is terrible or not. The premise they argued was that x browser doesn't support y feature while z browser does. Eventually, I agreed with him on this and made this plugin to save web developers from having to memorize the browser compatibility of WebAPIs.

Related

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

eslint-plugin-compat's People

Contributors

alopix avatar amilajack avatar andrewjong avatar bagage avatar bfred-it avatar bmish avatar dartess avatar dependabot[bot] avatar dkrnl avatar eligao avatar exarus avatar fnd avatar greenkeeper[bot] avatar hamirmahal avatar jaylinski avatar joeybaker avatar jooohhn avatar julien-f avatar kenju avatar koddsson avatar msakamaki avatar nathanmarks avatar orenklein avatar pwfcurry avatar ramonespinosa avatar renovate-bot avatar renovate[bot] avatar tbroyer avatar touzoku avatar trevorburnham 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eslint-plugin-compat's Issues

Element.closest() on IE11

Hi @amilajack! Seems like your plugin don't catch very common mistake for IE11 about not supporting of Element.closest().
This line has no errors for IE11 config:

const foo = documect.querySelector('.bar').closest('.baz');

But it's presented here - http://caniuse.com/#feat=element-closest

Same for NodeList#forEach in IE11 but actually I can't find it on caniuse.

P.S. To prove that config is working right:
image

Support for BROWSERSLIST_CONFIG?

Hello,

I was trying to use eslint-plugin-compat as a global plugin for projects that don't have package.json files.

I decided to define a browserslist file that I could reference through environment variable BROWSERSLIST_CONFIG as indicated here, but it didn't seem to work: I saw no error from the plugin.

Is it working as expected?
Is it possible to add support for this use case? (I can try to make a PR if you agree)

Thanks.

Plugin is ignoring `fetch` support for specific browser configuration

The plugin keeps complaining about fetch support:

WARNING in ./src/helpers/api.js

/all/dev/integrations/src/helpers/api.js
  12:24  warning  fetch is not supported in Safari 10, Opera Mobile 12.1, Opera Mini all, iOS Safari 10.0-10.2, IE Mobile 10, IE 10, Blackberry Browser 7, Android Browser 4.4.3-4.4.4, Android UC Browser 11.4  compat/compat

My package.json has:

{
  "browserslist": ["Chrome >= 47"]
}

And I have some code like this in src/helpers/api.js:

export const api = {
	get: (url, params) => fetch('/endpoint').then(res => res.json())
};

As I'm targeting just Chrome 47 and above I should have no warnings about fetch which is supported since Chrome 42/43 according to https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#Browser_compatibility.

Lint error

Running into this issue:

Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
    at /XXX/node_modules/eslint-plugin-compat/lib/providers/CanIUseProvider.js:100:47
    at Array.filter (native)
    at getUnsupportedTargets (/XXX/node_modules/eslint-plugin-compat/lib/providers/CanIUseProvider.js:99:20)
    at Object.isValid (/XXX/node_modules/eslint-plugin-compat/lib/providers/CanIUseProvider.js:87:12)
    at /XXX/node_modules/eslint-plugin-compat/lib/Lint.js:57:20
    at Array.find (native)
    at Lint (/XXX/node_modules/eslint-plugin-compat/lib/Lint.js:56:6)
    at EventEmitter.lint (/XXX/node_modules/eslint-plugin-compat/lib/rules/compat.js:49:40)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)

Testing against:

const sw = navigator.serviceWorker

node v6.5.0
eslint v3.12.2
eslint-plugin-compat v0.1.3

An in-range update of tcomb is breaking the build 🚨

Version 3.2.19 of tcomb just got published.

Branch Build failing 🚨
Dependency tcomb
Current Version 3.2.18
Type devDependency

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

As tcomb is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

Release Notes v3.2.19
  • Polish
    • add strict (struct, interface) to typescript definition (@gcanti)
Commits

The new version differs by 1 commits .

  • e4b8770 add strict (struct, interface) in typescript definition

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Prevent the usage of experimental API's

Detect usage of API's whose specs have not been standardized

Idea:

// Assume that Atomics/Shared Memory are experimental in JS
const buffer = new SharedArrayBuffer(1024);
// ^ Error: compat/no-experimantal-apis: Unallowed use of experimental APIs

An in-range update of babel-register is breaking the build 🚨

Version 6.24.0 of babel-register just got published.

Branch Build failing 🚨
Dependency babel-register
Current Version 6.23.0
Type devDependency

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

As babel-register is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

`fetch` (and others?) is not throwing an error in certain old browser versions

I am not sure how deep this problem goes, but here is an easy way to reproduce the symptom:

  1. Clone the eslint-plugin-compat-demo
  2. Remove the fetch polyfill support from the .eslintrc file.
  3. Change browserslist to ["Chrome 49"].

Upon reloading the App.js file, you would now expect three red dots in Atom. Instead, there are still only two.

compat fail

I do not know how many Javascript APIs this problem affects (I happened to use fetch to test my setup) and I do not know which browser queries cause this issue (I happened to try Chrome 49 because I am testing for Windows XP support in my project).

An in-range update of browserslist is breaking the build 🚨

Version 1.7.0 of browserslist just got published.

Branch Build failing 🚨
Dependency browserslist
Current Version 1.6.0
Type dependency

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

As browserslist is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

Commits

The new version differs by 6 commits .

  • 8f9e25d Release 1.7 version
  • d21e644 Update dependencies
  • 1587119 Allow passing stats and env when β€”-config is given (#111) (#112)
  • 4f5c764 Fix syntax error in example
  • b7c5b3e More clear package.json example
  • 41d610b More clear docs

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Custom Browser Definitions - using rulesets in addition to caniuse-db and kangax

I would like to provide developers targeting our custom browser with a way to use their existing eslint toolchain (which uses eslint-plugin-compat), in conjunction with an additional JSON file containing the list of features a custom browser supports/does-not-support. The fact is caniuse-db only provides a subset of the known browsers, so browser vendors that want to hook into this toolchain currently would need to fork several projects to add their custom rulesets.

Would there be interest in providing a means to add custom browser configurations via a mix-in that augments the /src/providers/CanIUseProvider to have all of the data found in 'caniuse-db/fulldata-json/data-2.0.json'; plus that in some-custom-browser.json?

I am interested in contributing this feature if there is interest from maintainers in having it. I think it makes sense that custom browser vendors run the tests from http://tests.caniuse.com to generate a result set specific to their browser, and publish it publicly for inclusion in eslint-plugin-compat.

Check dependencies

Is there a way to check if the dependencies of the application respect the compatibility specifications? Even if it's only one time and not at each build.

String methods compatibility.

Cannot lint some string methods correctlly.

Methods IE Compatibility
String.endsWith() IE didn't support
String.normalize() IE didn't support
String.includes() IE didn't support
String.localeCompare() IE11
String.repeat() IE didn't support
String.startsWith() IE didn't support
String.trimLeft() not standard
String.trimRight() not standard

MDN - String.prototype.endsWith()

Use Browserslist 2

We released Browserslist 2 with (full changelog with our reasons):

  1. Better performance because of caching
  2. It depends on caniuse-lite (1 MB) instead of caniuse-db (7 MB)
  3. Now last n versions contains all browsers

Unfortunately, this changes requires major update for this tool too. But all this changes are important and will not have problems for most of users. As people told on conferences β€” don’t afraid major releases, just make changes smaller β€” it is best example.

We already released Autoprefixer 7 and doiuse 3 with new Browserslist. It is important for community to have same Browserslist version (especially because of different last n versions behaviour).

@amilajack can you release 2.0 with new Browserslist soon?

browserlist/babel-preset-env config sharing

The readme mentions specifying target versions in the config, but doing that doesn't seem to work. "ie 9" and "ie >= 9" both break eslint, "ie" itself works fine.

Output:

TypeError: Cannot convert undefined or null to object
    at /home/mischka/projects/residentprogram/node_modules/eslint-plugin-compat/lib/providers/CanIUseProvider.js:100:47
    at Array.filter (native)
    at getUnsupportedTargets (/home/mischka/projects/residentprogram/node_modules/eslint-plugin-compat/lib/providers/CanIUseProvider.js:99:20)
    at Object.isValid (/home/mischka/projects/residentprogram/node_modules/eslint-plugin-compat/lib/providers/CanIUseProvider.js:87:12)
    at /home/mischka/projects/residentprogram/node_modules/eslint-plugin-compat/lib/Lint.js:57:20
    at Array.find (native)
    at Lint (/home/mischka/projects/residentprogram/node_modules/eslint-plugin-compat/lib/Lint.js:56:6)
    at EventEmitter.lint (/home/mischka/projects/residentprogram/node_modules/eslint-plugin-compat/lib/rules/compat.js:49:40)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)

Thanks, this is a super neat idea, really excited for it.

Use caniuse-lite

We loved caniuse-db, but it uses 7 MB and contains many irrelevant data.

This is why @ben-eb created caniuse-lite. It is just a copy of latest caniuse-db (he wrote autorelease script) with less data and better compression. Only 1 MB.

Autoprefixer and Browserslist moved to caniuse-lite. So let’s use it here too. It is very easy, API is the same.

Allow Polyfill Imports

This is probably hard but I don't think this plugin should warn about usages of APIs that are polyfilled. For instance, say I have a component that uses fetch. With the compat plugin I get:

error  fetch is not supported in Safari 9.1, Opera Mini all, iOS Safari 9.3, IE Mobile 10, IE 10, Edge 13, Android Browser 4.4, Android UC Browser 11  compat/compat

When I add a polyfyll in this component, for instance by adding import fetch from ('some-fetch-lib'); at the top of the file, the plugin should not display the warning. This helps me remember to add a fetch polyfill when needed.

I could add the polyfill to the config, but then I could easily launch the code without importing a fetch polyfill, and the site would be broken for browsers without fetch support.

Crash when browserslist is newer than caniuse-db

A new release of browserslist may produce, e.g., chrome 56, but the data in caniuse-db (or in the snapshot included in 1.0.1) does not include it if it is old enough.

This results in attempting to call .includes('n') on undefined instead of string, which is a crash.

Enhancement: Allow imported npm modules to be checked

It would be nice to actually check that imported modules from node_modules are actually compatible as well.

For example, if I import a module that runs fetch without my knowledge, I'd love to see an error when I lint.

Perhaps that is beyond the capabilities of eslint?

Support eslint 4.0.0

Eslint 4.0.0 was released a week ago. This package defines eslint as a peerDependency with version ^3.0.0.

Allow Duck-typing checks for conditional API compat logic

UPDATE: Here's a related discussion in the eslint-typescript repo that's worth looking into

Allow checking for if lib or property is defined. Disallow calling the method

// Checking if objects are defined
if (typeof ServiceWorker === 'undefined') {} // βœ… allowed

// Checking if properties/methods are defined
if (String.prototype.includes) {} // βœ… allowed

// Checking if properties/methods are defined and
// subsequently invoking/accessing them
if (String.prototype.includes) { // βœ… allowed
  if ('some'.includes('e')) { // βœ… allowed
    // do some action
  }
}

// βœ… allowed
if ("serviceWorker" in navigator) {
  navigator.serviceWorker...
}

// βœ… allowed
if (String.prototype.includes && 'some'.includes('e')) {}
if ('foo'.includes && 'some'.includes('e')) {}

// ❌ disallowed
if ('some'.includes('e')) {}

// ❌ disallowed
if (!'some'.includes('e')) {
  'some'.includes('e')
}

An in-range update of browserslist is breaking the build 🚨

Version 1.7.1 of browserslist just got published.

Branch Build failing 🚨
Dependency browserslist
Current Version 1.7.0
Type dependency

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

As browserslist is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

Commits

The new version differs by 3 commits .

  • 4ce9586 Release 1.7.1 version
  • 773a294 Update dependencies
  • 61221fc Fix released/unreleased versions split

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

ESLint couldn't find the plugin "eslint-plugin-compat"

I've been trying to set up this plugin (I have already verified autoprefixer is working correctly with my .browserslistrc file, so that's not the problem).

It didn't seem to be working in VScode or gulp, so I tried running it globally which suggested that it cannot be located for whatever reason:

$ eslint --cache .

Oops! Something went wrong! :(

ESLint couldn't find the plugin "eslint-plugin-compat". This can happen for a couple different reasons:

1. If ESLint is installed globally, then make sure eslint-plugin-compat is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm i eslint-plugin-compat@latest --save-dev

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

I have wiped and re-installed local npm, nothing has made a difference. The package is definitely installed:

$ npm i eslint-plugin-compat@latest --save-dev
[email protected] /Users/x/xxx/xxx/xxxxxxxx
└── [email protected]

npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

And, is definitely inside node_modules:

$ ls -la ./node_modules/eslint-plugin-compat/
total 32
drwxr-xr-x    7 phil  admin    238 May  8 12:06 .
drwxr-xr-x  924 phil  admin  31416 May  8 12:06 ..
-rw-r--r--    1 phil  admin   1072 Jan 18 16:34 LICENSE
-rw-r--r--    1 phil  admin   3292 Jan 24 00:42 README.md
drwxr-xr-x    9 phil  admin    306 May  8 12:06 lib
drwxr-xr-x    4 phil  admin    136 May  8 12:06 node_modules
-rw-r--r--    1 phil  admin   4275 May  8 12:06 package.json

More info:

.eslintrc.js

/** @file eslint configuration for xxx application in ES5 browser environment. */
module.exports = {
  "env": {
    // because *.spec.js files are in scope:
    "jasmine": true,
    "node": false,
    "browser": true,
    "es6": false
  },
  "globals": {
    // Includes browser globals like FileReader, Blob, etc..:
    "browser": true,
    "$": true,
    "jQuery": true,
    "angular": true,
    "moment": true,
    "_": true,
    "L": true,
    "Chartist": true,
    "saveAs": true
  },
  "plugins": [
    "compat"
  ],
  "rules": {
    "no-bitwise": 2,
    "camelcase": 0,
    // TODO: Cleanup these errors and enforce:
    "curly": 0,
    "eqeqeq": 2,
    "wrap-iife": [ 2, "any" ],
    // TODO: Enforce proper code formatting:
    "indent": [ 0, 2, { "SwitchCase": 1 }],
    "no-use-before-define": [ 2, { "functions": false }],
    // TODO: Investigate whether this should be enforced:
    "new-cap": 0,
    "no-caller": 2,
    "quotes": [ 2, "single" ],
    "no-undef": 2,
    "no-unused-vars": 2,
    // TODO: 'use-strict' should be refactored and enforced:
    "strict": [ 0, "function"],
    // so we can assign 'this' in our controllers :
    "no-invalid-this": 0,
    // Looks up .browserslistrc to see if your code is supported
    "compat/compat": 2
  }
}

package.json:

{
  "name": "xxxxz",
  "version": "0.0.0",
  "dependencies": {
    "bower": "*",
    "gulp": "3.9.1",
    "gulp-eslint": "^3.0.1",
  },
  "devDependencies": {
    "eslint": "3.19.0",
    "eslint-plugin-compat": "^1.0.2",
    "eslint-plugin-import": "2.2.0"
  },
  "engines": {
    "node": "~6.x.x",
    "npm": "3.x"
  }
}

Unsuccessful resolution attempts:

  • Didn't help: Install babel-eslint package
  • Didn't help: Rename .browserslistrc to browserslist
  • Didn't help: Install eslint, eslint-plugin-compat globally
  • Didn't help: Run eslint . globally

Browser Targets not working

Hey,

So, following the config provided in the README.md, I have targets: ["chrome >= 50"] in my .eslintrc.

When running the lint, however, I get

TypeError: Cannot convert undefined or null to object
    at keys (<anonymous>)
    at node_modules/eslint-plugin-compat/lib/providers/CanIUseProvider.js:103:47
    at Array.filter (native)

I put some logging in, and it seems that when I use 'chrome >= 50' it dies (on any browser, specifying a version like that makes it die), but providing the raw browser name (chrome or firefox) makes the lint work.

.eslintrc settings:

"settings": {
    "targets": [
      "chrome >= 50", "firefox", "edge", "safari >= 10"
    ],
    "compiler": "babel",
}

Not raising errors for navigator.hardwareConcurrency or new SharedWorker()

These features are unsupported, listed on caniuse.com, but don't raise errors as expected:

navigator.hardwareConcurrency; // no eslint error
navigator.serviceWorker; // [eslint] navigator.serviceWorker() is not supported in Safari 8, iOS Safari 8, IE 11, Edge 13 (compat/compat)
new SharedWorker(); // no eslint error
# browserlist

# Desktop:
last 2 Chrome version
last 2 Firefox version
last 2 Edge version
Safari >= 8
IE 11

# Mobile:
last 2 ChromeAndroid version
last 2 FirefoxAndroid version
iOS >= 8
// package.json
 "eslint-plugin-compat": "1.0.2",
// .eslintrc.js
module.exports = {
  "env": {
    // because *.spec.js files are in scope:
    "jasmine": true,
    "node": false,
    "browser": true,
    "es6": false
  },
  "globals": {
    // Includes browser globals like FileReader, Blob, etc..:
    "browser": true,
    "$": true,
    "jQuery": true,
    "angular": true,
    "moment": true,
    "_": true,
    "L": true,
    "Chartist": true,
    "saveAs": true
  },
  "plugins": [
    // Looks up 'browserslist' file to see if your code is supported:
    "compat"
  ],
  "rules": {
    "no-bitwise": 2,
    "camelcase": 0,
    // TODO: Cleanup these errors and enforce:
    "curly": 0,
    "eqeqeq": 2,
    "wrap-iife": [ 2, "any" ],
    // TODO: Enforce proper code formatting:
    "indent": [ 0, 2, { "SwitchCase": 1 }],
    "no-use-before-define": [ 2, { "functions": false }],
    // TODO: Investigate whether this should be enforced:
    "new-cap": 0,
    "no-caller": 2,
    "quotes": [ 2, "single" ],
    "no-undef": 2,
    "no-unused-vars": 2,
    // TODO: 'use-strict' should be refactored and enforced:
    "strict": [ 0, "function"],
    // so we can assign 'this' in our controllers :
    "no-invalid-this": 0,
    // Looks up 'browserslist' file to see if your code is supported:
    "compat/compat": 2
  }
}

Kangax table implementation?

The readme shows that Kangax compatibility tables are taken into account in this plugin, but I get no warnings when I configure browserslist: ['ie 10'] and use Object.assign() for example

Is this a bug or am I using it wrong?

Node.js support

Eager to try this--great concept!

I think it would be great to also allow such linting with a Node environment (with its own distinct config) in the case of repos using Node.js (via http://node.green/ ?) instead of or in addition to the browser.

Running in CI

I have looked through the READMEs and one thing remains unclear to me.

If I have a number of JS files in a project, can I run your tool on them and get a status code 0 if my target browsers fully support my JS and non-zero code otherwise?

I would love to have it as one of the tests in CI.

An in-range update of cross-env is breaking the build 🚨

Version 3.2.0 of cross-env just got published.

Branch Build failing 🚨
Dependency cross-env
Current Version 3.1.4
Type devDependency

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

As cross-env is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

Release Notes v3.2.0

<a name"3.2.0">

3.2.0 (2017-03-04)

Features

  • revamp: revamp the entire lib (backward compatible) (#63) (dad00c46)
Commits

The new version differs by 4 commits .

  • dad00c4 feat(revamp): revamp the entire lib (backward compatible) (#63)
  • e33a85c docs(README): Add doc for cross-var. (#58)
  • 5e590ec docs(README): added how to use cross-env to run npm sub-scripts (#53)
  • afdb2de docs(README): mention BashΒ onΒ Windows (#49)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Does not reference `.browserslistrc` (had to rename to `browserlist`) + Still errors if no browsers defined

This should lookup the filenames as described at the browserlist project.

Repro

  1. Download the eslint-plugin-compat-demo branch
  2. Follow the instructions and run it successfully.
  3. Remove the 'browserlist' line in package.json
  4. Create a new file .browserslistrc and add the text 'IE9', run npm lint again:
$ npm run lint

> [email protected] lint /Users/phil/eslint-plugin-compat-demo
> eslint .


/Users/phil/eslint-plugin-compat-demo/App.js
  5:13  error  PaymentRequest is not supported in Samsung Browser 4, Safari 9.1, Opera 42, Opera Mini all, iOS Safari 9.3, IE Mobile 10, IE 10, Firefox 45, Edge 13, Chrome 49, Android Browser 4.4, Android UC Browser 11  compat/compat
  9:18  error  IntersectionObserver is not supported in Samsung Browser 4, Safari 9.1, Opera Mini all, iOS Safari 9.3, IE Mobile 10, IE 10, Firefox 45, Edge 13, Chrome 49, Android Browser 4.4, Android UC Browser 11      compat/compat

βœ– 2 problems (2 errors, 0 warnings)
  1. Rename .browserslistrc to browserlist and run npm lint again:
$ npm run lint

> [email protected] lint /Users/phil/eslint-plugin-compat-demo
> eslint .


/Users/phil/eslint-plugin-compat-demo/App.js
  5:13  error  PaymentRequest is not supported in IE 9        compat/compat
  9:18  error  IntersectionObserver is not supported in IE 9  compat/compat

βœ– 2 problems (2 errors, 0 warnings)
  1. Delete the browserlist file entirely.
$ npm run lint

> [email protected] lint /Users/phil/eslint-plugin-compat-demo
> eslint .


/Users/phil/eslint-plugin-compat-demo/App.js
  5:13  error  PaymentRequest is not supported in Samsung Browser 4, Safari 9.1, Opera 42, Opera Mini all, iOS Safari 9.3, IE Mobile 10, IE 10, Firefox 45, Edge 13, Chrome 49, Android Browser 4.4, Android UC Browser 11  compat/compat
  9:18  error  IntersectionObserver is not supported in Samsung Browser 4, Safari 9.1, Opera Mini all, iOS Safari 9.3, IE Mobile 10, IE 10, Firefox 45, Edge 13, Chrome 49, Android Browser 4.4, Android UC Browser 11      compat/compat

Result

It seems that these behaviours are expected but not working:

An in-range update of babel-preset-es2015 is breaking the build 🚨

Version 6.24.0 of babel-preset-es2015 just got published.

Branch Build failing 🚨
Dependency babel-preset-es2015
Current Version 6.22.0
Type devDependency

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

As babel-preset-es2015 is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of browserslist is breaking the build 🚨

Version 1.7.3 of browserslist just got published.

Branch Build failing 🚨
Dependency browserslist
Current Version 1.7.2
Type dependency

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

As browserslist is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

Commits

The new version differs by 3 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

browserslist lookup isn't relative to target file

Ideally, it should behave similarly to the .eslintrc resolution. Right now it's relative to process.cwd(), which is not a nice place to be.

This can probably be helped by giving the path of the file being linted as the path option in the browserslist calls, e.g. browserslist(undefined, { path: filePath })

An in-range update of babel-plugin-transform-es2015-modules-umd is breaking the build 🚨

Version 6.24.0 of babel-plugin-transform-es2015-modules-umd just got published.

Branch Build failing 🚨
Dependency babel-plugin-transform-es2015-modules-umd
Current Version 6.23.0
Type devDependency

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

As babel-plugin-transform-es2015-modules-umd is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

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.