Skip to content

🚨 Ignore docs when linting #510

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

Merged
merged 1 commit into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
// The ESLint ecmaVersion argument is inconsistently used. Some rules will ignore it entirely, so if the rule has
// been set, it will still error even if it's not applicable to that version number. Since Google sets these
// rules, we have to turn them off ourselves.
const DISABLED_ES6_OPTIONS = {
var DISABLED_ES6_OPTIONS = {
'no-var': 'off',
'prefer-rest-params': 'off'
};

const SHAREDB_RULES = {
var SHAREDB_RULES = {
// Comma dangle is not supported in ES3
'comma-dangle': ['error', 'never'],
// We control our own objects and prototypes, so no need for this check
'guard-for-in': 'off',
// Google prescribes different indents for different cases. Let's just use 2 spaces everywhere. Note that we have
// to override ESLint's default of 0 indents for this.
'indent': ['error', 2, {
'SwitchCase': 1
indent: ['error', 2, {
SwitchCase: 1
}],
// Less aggressive line length than Google, which is especially useful when we have a lot of callbacks in our code
'max-len': ['error',
{
code: 120,
tabWidth: 2,
ignoreUrls: true,
ignoreUrls: true
}
],
// Google overrides the default ESLint behaviour here, which is slightly better for catching erroneously unused variables
// Google overrides the default ESLint behaviour here, which is slightly better for catching erroneously unused
// variables
'no-unused-vars': ['error', {vars: 'all', args: 'after-used'}],
// It's more readable to ensure we only have one statement per line
'max-statements-per-line': ['error', {max: 1}],
Expand All @@ -46,4 +47,7 @@ module.exports = {
DISABLED_ES6_OPTIONS,
SHAREDB_RULES
),
ignorePatterns: [
'/docs/'
]
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"devDependencies": {
"chai": "^4.2.0",
"coveralls": "^3.0.7",
"eslint": "^6.5.1",
"eslint": "^7.32.0",
"eslint-config-google": "^0.14.0",
"ot-json0-v2": "ottypes/json0",
"lolex": "^5.1.1",
"mocha": "^8.2.1",
"nyc": "^14.1.1",
"ot-json0-v2": "ottypes/json0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, why did we need to add this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it just got moved when I ran npm install — I'd added this by hand before, and I guess I don't alphabet so good 🤦🏼‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right and I don't read diffs good

"ot-json1": "^0.3.0",
"sharedb-legacy": "npm:sharedb@=1.1.0",
"sinon": "^7.5.0"
Expand Down