Skip to content

Commit

Permalink
Merge pull request #9698 from rtibbles/linting_updates
Browse files Browse the repository at this point in the history
Linting updates
  • Loading branch information
rtibbles authored Jun 20, 2024
2 parents c5ae2e8 + 689363c commit 9b89f7c
Show file tree
Hide file tree
Showing 639 changed files with 7,560 additions and 5,633 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
require("@rushstack/eslint-patch/modern-module-resolution");
module.exports = require('kolibri-tools/.eslintrc');
8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Run this command to always ignore formatting commits in `git blame`
# git config blame.ignoreRevsFile .git-blame-ignore-revs

# Applied black to the codebase
7dadc107cebd3ab4597f1aa4f159940872466dec

# Reformatted all frontend code using prettier v3
42efde27bac137734f05057278c4827168d119f2
1 change: 0 additions & 1 deletion .htmlhintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/frontend_architecture/conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ For design conventions, see the `Kolibri Design System <http://kolibribeta.learn
Linting and auto formatting
---------------------------

Many of our conventions are enforced through various linters including `ESLint <https://eslint.org/>`__, `ESLint Vue plugin <https://github.com/vuejs/eslint-plugin-vue>`__, `stylelint <https://stylelint.io/>`__, and `HTMLHint <https://htmlhint.io/>`__. The enforced rules are located in the ``.eslintrc.js``, ``.stylelintrc.js``, and ``.htmlhintrc`` files located at the root of the project.
Many of our conventions are enforced through various linters including `ESLint <https://eslint.org/>`__, `ESLint Vue plugin <https://github.com/vuejs/eslint-plugin-vue>`__, `stylelint <https://stylelint.io/>`__, and `HTMLHint <https://htmlhint.io/>`__. The enforced rules are located in the ``eslint.config.js``, ``.stylelintrc.js``, and files located at the root of the project.

Also available are options and tools that enable auto-formatting of ``.vue``, ``.js``, ``.scss``, and ``.py`` files to conform to code conventions. To facilitate this, we use `Black <https://github.com/ambv/black>`__ to auto-format ``.py`` files, and `Prettier <https://prettier.io/>`__ to auto-format the others. Auto-formatting runs by default while running the dev server, otherwise be sure to run the dev server with ``-warn`` as described in :doc:`/getting_started` to prevent it from auto-formatting.

Expand Down
6 changes: 6 additions & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ Next, initialize Git LFS:
cd kolibri # Enter the Kolibri directory
git lfs install
To make git blame more informative, we keep track of commits that make a lot of changes to the codebase but are not directly related to the code itself, like large scale automatic code formatting. To prevent these commits appearing in the blame output, run:

.. code-block:: bash
git config blame.ignoreRevsFile .git-blame-ignore-revs
Finally, add the Learning Equality repo as a remote called `upstream`. That way you can keep your local checkout updated with the most recent changes:


Expand Down
32 changes: 16 additions & 16 deletions kolibri/core/assets/src/api-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ export class Model {
reject(response);
// Clean up the reference to this promise
this.promises.splice(this.promises.indexOf(promise), 1);
}
},
);
}
},
reason => {
reject(reason);
}
},
);
});
this.promises.push(promise);
Expand Down Expand Up @@ -164,13 +164,13 @@ export class Model {
reject(response);
// Clean up the reference to this promise
this.promises.splice(this.promises.indexOf(promise), 1);
}
},
);
}
},
reason => {
reject(reason);
}
},
);
});
this.promises.push(promise);
Expand Down Expand Up @@ -214,13 +214,13 @@ export class Model {
reject(response);
// Clean up the reference to this promise
this.promises.splice(this.promises.indexOf(promise), 1);
}
},
);
}
},
reason => {
reject(reason);
}
},
);
});
this.promises.push(promise);
Expand Down Expand Up @@ -340,13 +340,13 @@ export class Collection {
reject(response);
// Clean up the reference to this promise
this.promises.splice(this.promises.indexOf(promise), 1);
}
},
);
}
},
reason => {
reject(reason);
}
},
);
});
this.promises.push(promise);
Expand Down Expand Up @@ -399,12 +399,12 @@ export class Collection {
reject(response);
// Clean up the reference to this promise
this.promises.splice(this.promises.indexOf(promise), 1);
}
},
);
},
reason => {
reject(reason);
}
},
);
});
this.promises.push(promise);
Expand Down Expand Up @@ -450,13 +450,13 @@ export class Collection {
reject(response);
// Clean up the reference to this promise
this.promises.splice(this.promises.indexOf(promise), 1);
}
},
);
}
},
reason => {
reject(reason);
}
},
);
});
this.promises.push(promise);
Expand Down Expand Up @@ -602,8 +602,8 @@ export class Resource {
.sort()
.map(paramKey => ({
[paramKey]: paramKey === this.idKey ? String(allParams[paramKey]) : allParams[paramKey],
}))
)
})),
),
);
}

Expand Down Expand Up @@ -926,7 +926,7 @@ export class Resource {

create(params = {}, multipart = false) {
return this.accessListEndpoint('post', 'list', params, multipart).then(
response => response.data
response => response.data,
);
}

Expand Down Expand Up @@ -1038,7 +1038,7 @@ export class Resource {
`%cRequest error: ${err.response.statusText}, ${
err.response.status
} for ${err.config.method.toUpperCase()} to ${err.config.url} - open for more info`,
'color: red'
'color: red',
);
console.log(`Error occured for ${this.name} resource on page ${window.location.href}`);
if (store?.state?.route) {
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/api-resources/contentNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default new Resource({
if (data[this.idKey]) {
this.cache[data[this.idKey]] = Object.assign(
this.cache[data[this.idKey]] || {},
cloneDeep(data)
cloneDeep(data),
);
if (data.children) {
this.cacheData(data.children);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const logging = logger.getLogger(__filename);
export default function useMinimumKolibriVersion(
majorVersion = 0,
minorVersion = 15,
revisionVersion = null
revisionVersion = null,
) {
const isMinimumKolibriVersion = useMemoize(version => {
if (!version) {
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/composables/useUserSyncStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function fetchUserSyncStatus(params) {
error => {
store.dispatch('handleApiError', { error });
return error;
}
},
);
}

Expand Down
Loading

0 comments on commit 9b89f7c

Please sign in to comment.