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

loleaflet: Bump eslint version to 6.0.0 #396

Closed
mrkara opened this issue Oct 22, 2020 · 3 comments
Closed

loleaflet: Bump eslint version to 6.0.0 #396

mrkara opened this issue Oct 22, 2020 · 3 comments

Comments

@mrkara
Copy link
Member

mrkara commented Oct 22, 2020

This is an Easy Hack.
Potential mentors: @mrkara

eslint is an npm package for identifying and reporting on patterns found in ECMAScript/JavaScript code and the version we have (5.0.0, specified in loleaflet/package.json) is a bit outdated. So let's update it to 6.0.0 at least for now.

Follow the instructions on the forum to send your first pull request. And consider the instructions below fits into the Do you changes, rebuild & test etc. step.

Follow the instructions here to skip the build step: https://forum.collaboraonline.com/t/start-developing-cool-on-any-platform-in-5-minutes/52

You need to first, find this line in loleaflet/package.json:

"eslint": "5.0.0"

and change it to look like this:

"eslint": "6.0.0"

Then issue this command so that the new version of the package will be downloaded, along with its dependencies, and a new check on the source code is triggered:

make clean && make -j `nproc`

The command above might take a few minutes or more depending on the power of your PC. In the meantime, read through the
guide: Migrating to v6.0.0

If the command above gives any errors, fix the errors on the indicated files. (Error messages will tell you the line and column numbers for each error.)

After fixing each file, check the diff to make sure it looks all okay:

git diff

When you are done with all of the listed files, make sure the code builds without errors now:

make clean && make -j `nproc`

Even better, run it, and connect to it via your browser to verify all looks okay:

make run

If you are satisfied with the results. Then commit your changes, push the commit to your forked repo, and create a pull request via web interface. :)

@srana6
Copy link

srana6 commented Oct 23, 2020

@mrkara I can work on this

@mrkara
Copy link
Member Author

mrkara commented Oct 23, 2020

@srana6 Great! Please, go ahead. :)

mrkara pushed a commit that referenced this issue Oct 31, 2020
The "extends": "eslint:recommended" property in a configuration file enables this rule.

In ECMAScript 5.1, Object.create was added, which enables the creation of objects
with a specified [[Prototype]]. Object.create(null) is a common pattern used to create
objects that will be used as a Map. This can lead to errors when it is assumed that
objects will have properties from Object.prototype. This rule prevents calling some
Object.prototype methods directly from an object.

Additionally, objects can have properties that shadow the builtins on Object.prototype,
potentially causing unintended behavior or denial-of-service security vulnerabilities.
For example, it would be unsafe for a webserver to parse JSON input from a client and
call hasOwnProperty directly on the resulting object, because a malicious client could
send a JSON value like {"hasOwnProperty": 1} and cause the server to crash.

To avoid subtle bugs like this, it's better to always call these methods from Object.prototype.
For example, foo.hasOwnProperty("bar") should be replaced with Object.prototype.hasOwnProperty.call(foo, "bar").

See: https://eslint.org/docs/rules/no-prototype-builtins

Change-Id: Id7723f0f0ed81e074f56955f80eda3d70241294e
Signed-off-by: Ayhan Yalçınsoy <ayhanyalcinsoy@pisilinux.org>
mrkara pushed a commit that referenced this issue Nov 10, 2020
Signed-off-by: Ayhan Yalçınsoy <ayhanyalcinsoy@pisilinux.org>
Change-Id: I08f7cc953aa6434fccbc92d74570c62a43c7dad9
@mrkara
Copy link
Member Author

mrkara commented Nov 20, 2020

Resolved.

@mrkara mrkara closed this as completed Nov 20, 2020
Ezinnem pushed a commit to Ezinnem/online that referenced this issue Dec 22, 2020
…iltins

The "extends": "eslint:recommended" property in a configuration file enables this rule.

In ECMAScript 5.1, Object.create was added, which enables the creation of objects
with a specified [[Prototype]]. Object.create(null) is a common pattern used to create
objects that will be used as a Map. This can lead to errors when it is assumed that
objects will have properties from Object.prototype. This rule prevents calling some
Object.prototype methods directly from an object.

Additionally, objects can have properties that shadow the builtins on Object.prototype,
potentially causing unintended behavior or denial-of-service security vulnerabilities.
For example, it would be unsafe for a webserver to parse JSON input from a client and
call hasOwnProperty directly on the resulting object, because a malicious client could
send a JSON value like {"hasOwnProperty": 1} and cause the server to crash.

To avoid subtle bugs like this, it's better to always call these methods from Object.prototype.
For example, foo.hasOwnProperty("bar") should be replaced with Object.prototype.hasOwnProperty.call(foo, "bar").

See: https://eslint.org/docs/rules/no-prototype-builtins

Change-Id: Id7723f0f0ed81e074f56955f80eda3d70241294e
Signed-off-by: Ayhan Yalçınsoy <ayhanyalcinsoy@pisilinux.org>
Ezinnem pushed a commit to Ezinnem/online that referenced this issue Dec 22, 2020
Signed-off-by: Ayhan Yalçınsoy <ayhanyalcinsoy@pisilinux.org>
Change-Id: I08f7cc953aa6434fccbc92d74570c62a43c7dad9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants