Skip to content

Commit

Permalink
style: use shared ESLint config (#1042)
Browse files Browse the repository at this point in the history
* style: use shared ESLint config

* docs: fix HTML errors

* style: reformat

* style: manual fixes

Co-authored-by: Vis Bot <[email protected]>
  • Loading branch information
Thomaash and vis-bot authored Sep 12, 2020
1 parent 45daf9c commit 901442a
Show file tree
Hide file tree
Showing 221 changed files with 212,963 additions and 105,821 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
- attach_workspace:
at: ..

- run: npm run style
- run: npm run lint

test_unit:
Expand Down
23 changes: 18 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
/*

!/*?.?*
!/.?*.?*

!/docs
!/docs-kr
!/src
!/test

!/cypress
/cypress/fixtures/**/*.js
/cypress/fixtures/**/*.js.map
/cypress/integration/**/*.js
/cypress/integration/**/*.js.map
/cypress/pages/**/*.js
/cypress/pages/**/*.js.map
/cypress/screenshots/
/cypress/snapshots/
/cypress/screenshots
/cypress/snapshots
/cypress/support/**/*.js
/cypress/support/**/*.js.map
/cypress/videos/
/cypress/videos

!/examples
/examples/examples.css
/examples/index.html
/examples/static/
/examples/thumbnails/
/examples/static
/examples/thumbnails
119 changes: 1 addition & 118 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,120 +1,3 @@
module.exports = {
env: {
"cypress/globals": true,
browser: true,
es6: true,
node: true,
mocha: true
},

parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
project: 'tsconfig.lint.json',
extraFileExtensions: [".json"],
},

plugins: ["prettier", "@typescript-eslint", "cypress"],

extends: ['eslint:recommended', 'prettier'],

// For the full list of rules, see: http://eslint.org/docs/rules/
rules: {
'prettier/prettier': ['off'],
'no-trailing-spaces': 'error',

complexity: ['error', 55],
"max-statements": ['error', 115],
"no-unreachable": 'warn',
"no-useless-escape": 'off',

"no-console": 'off',
// To flag presence of console.log without breaking linting:
//"no-console": ["warn", { allow: ["warn", "error"] }],

"require-jsdoc": ["error", {
require: {
FunctionDeclaration: true,
MethodDefinition: true,
ClassDeclaration: true,
ArrowFunctionExpression: false
}
}],
"valid-jsdoc": ['error', {
requireReturnDescription: false,
requireReturn: false,
requireParamDescription: false,
requireReturnType: true
}],
"guard-for-in": 'warn',

"no-var": "error",
"prefer-const": "error",
},
overrides: [
{
files: ['**/*.ts', '**/*.d.ts'],
rules: {
// @TODO: Seems to mostly work just fine but I'm not 100 % sure.
// @TODO: Deprecated, anything like this for tsdoc?
"valid-jsdoc": [
"error",
{
prefer: {
arg: "param",
argument: "param",
return: "returns"
},
requireParamDescription: true,
requireParamType: false,
requireReturn: false, // Requires return for void functions.
requireReturnDescription: true,
requireReturnType: false
}
],

// Class related.
"@typescript-eslint/naming-convention": [
"error",
{
selector: "memberLike",
modifiers: ["private", "protected"],
format: null,
leadingUnderscore: "require"
},
{
selector: "memberLike",
modifiers: ["public"],
format: null,
leadingUnderscore: "forbid"
}
],
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/prefer-readonly": "error",

// Other.
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
// @TODO: Seems like a good thing, not yet on npm though.
// "@typescript-eslint/require-await": "error",

// These are hoisted, I have no idea why it reports them by default.
"@typescript-eslint/no-use-before-define": [
"error",
{ functions: false, classes: false, typedefs: false }
],
// False positives for overloading, also tsc compiles with errors anyway.
"no-dupe-class-members": "off",
// Blocks typesafe exhaustive switch (switch (x) { … default: const never: never = x }).
"no-case-declarations": "off",
// Reports used types.
"no-unused-vars": "off",
// Reports typeof bigint as an error, tsc validates this anyway so no problem turning this off.
"valid-typeof": "off"
}
},
]
extends: [require.resolve("vis-dev-utils/eslint-shareable-config")],
};
1 change: 1 addition & 0 deletions .prettierignore
8 changes: 4 additions & 4 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
branch: master
plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/release-notes-generator'
- '@semantic-release/npm'
- '@semantic-release/github'
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/npm"
- "@semantic-release/github"
22 changes: 11 additions & 11 deletions CODE-OF-CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down Expand Up @@ -68,4 +68,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[version]: http://contributor-covenant.org/version/1/4/
17 changes: 10 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
[Contributions](//github.com/visjs/vis-charts/blob/master/misc/how_to_help.md) to the vis.js library are very welcome! [We can't do this alone](//github.com/visjs/vis-charts/blob/master/misc/we_need_help.md).

### Questions
If you have any *general question* on how to use the vis.js library in your own project please check out [stackoverflow](http://stackoverflow.com/questions/tagged/vis.js) for things like that. **This is NOT a JavaScript help forum!**

If you have any _general question_ on how to use the vis.js library in your own project please check out [stackoverflow](http://stackoverflow.com/questions/tagged/vis.js) for things like that. **This is NOT a JavaScript help forum!**

### Bugs, Problems and Feature-Requests

If you really want to open a new issue:
* Please use the [search functionality](//github.com/visjs/vis-charts/issues) to make sure that there is not already an issue concerning the same topic.
* Please make sure to **mention which module** of vis.js (network, timeline, graph3d, ...) your are referring to.
* Note that development happens on the `develop` git branch. Be sure to submit PRs against this branch.
* If you think you found a bug please **provide a simple example** (e.g. on [jsbin](jsbin.com)) that demonstrates the problem.
* If you want to propose a feature-request please **describe what you are looking for in detail**, ideally providing a screenshot, drawing or something similar.
* **Close the issue later**, when the issue is no longer needed.

- Please use the [search functionality](//github.com/visjs/vis-charts/issues) to make sure that there is not already an issue concerning the same topic.
- Please make sure to **mention which module** of vis.js (network, timeline, graph3d, ...) your are referring to.
- Note that development happens on the `develop` git branch. Be sure to submit PRs against this branch.
- If you think you found a bug please **provide a simple example** (e.g. on [jsbin](jsbin.com)) that demonstrates the problem.
- If you want to propose a feature-request please **describe what you are looking for in detail**, ideally providing a screenshot, drawing or something similar.
- **Close the issue later**, when the issue is no longer needed.

## Financial contributions

Expand Down
Loading

0 comments on commit 901442a

Please sign in to comment.