Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
41 changes: 16 additions & 25 deletions .config/webpack/languages.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/**
* Config responsible for building not minified Handsontable `languages/` files.
*/
const NEW_LINE_CHAR = '\n';
const SOURCE_LANGUAGES_DIRECTORY = 'lib/i18n/languages';
const OUTPUT_LANGUAGES_DIRECTORY = 'languages';

const path = require('path');
const StringReplacePlugin = require('string-replace-webpack-plugin');
const WebpackOnBuildPlugin = require('on-build-webpack');
const fs = require('fs');
const fsExtra = require('fs-extra');
require('string-replace-loader');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you move it above declaring variables?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Turns out this require statement is not needed here. I removed it.


function getEntryJsFiles() {
const entryObject = {};
Expand All @@ -34,31 +33,23 @@ function getEntryJsFiles() {

const ruleForSnippetsInjection = {
test: /\.js$/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /\/\/.import/,
replacement: function() {
const snippet1 = `import HyperFormula from '../..';`;

return `${snippet1}${NEW_LINE_CHAR.repeat(2)}`;
loader: 'string-replace-loader',
options: {
multiple: [
{ search: 'export default dictionary', replace: `
if (!HyperFormula.languages) {
HyperFormula.languages = {};
}
},
{
pattern: /export default dictionary/,
replacement: function(matchingPhrase) {
const snippet = `
if (!HyperFormula.languages) {
HyperFormula.languages = {};
}
HyperFormula.languages[dictionary.langCode] = dictionary;
`;

return `${snippet}${NEW_LINE_CHAR.repeat(2)}${matchingPhrase}`;
}
}
HyperFormula.languages[dictionary.langCode] = dictionary;

export default dictionary
`},
{ search: /\/\/.import/, replace: `
import HyperFormula from '../..';

`}
]
})
}
};

module.exports.create = function create() {
Expand Down
73 changes: 42 additions & 31 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
root: true,
ignorePatterns: ['.eslintrc.js'],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
Expand Down Expand Up @@ -27,17 +28,21 @@ module.exports = {
delimiter: 'comma',
},
}],
'@typescript-eslint/camelcase': 'error',
'@typescript-eslint/naming-convention': [
'error',
{ 'selector': 'variableLike', 'format': ['camelCase', 'UPPER_CASE', 'PascalCase'], 'leadingUnderscore': 'allow' },
{ 'selector': 'interface', 'format': ['PascalCase'], 'custom': { 'regex': '^I[A-Z]', 'match': false } },
],
'@typescript-eslint/semi': ['error', 'never'],
'@typescript-eslint/brace-style': 'error', // wtf
'@typescript-eslint/brace-style': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'],
'@typescript-eslint/no-extra-non-null-assertion': ['error'],
'@typescript-eslint/no-throw-literal': ['error'],
'@typescript-eslint/array-type': ['error'],
'@typescript-eslint/space-before-function-paren': ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
'@typescript-eslint/space-before-function-paren': ['error', {
'anonymous': 'never',
'named': 'never',
'asyncArrow': 'always'
}],
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true }],
'@typescript-eslint/no-extra-semi': ['error'],
Expand All @@ -64,35 +69,41 @@ module.exports = {
'no-useless-escape': 'off',
'no-inner-declarations': 'off',

// Overrides
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/prefer-regexp-exec': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { 'argsIgnorePattern': '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/interface-name-prefix': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',

"jsdoc/check-access": 'warn',
"jsdoc/check-alignment": 'warn',
"jsdoc/check-param-names": 'warn',
"jsdoc/check-property-names": 'warn',
"jsdoc/check-tag-names": ['warn', {definedTags: ['category']}],
"jsdoc/check-types": 'warn',
"jsdoc/empty-tags": 'warn',
"jsdoc/implements-on-classes": 'warn',
"jsdoc/multiline-blocks": 'warn',
"jsdoc/newline-after-description": 'warn',
"jsdoc/no-multi-asterisks": 'warn',
"jsdoc/require-param-description": 'warn',
"jsdoc/require-param-name": 'warn',
"jsdoc/require-param-type": 'warn',
"jsdoc/require-property-description": 'warn',
"jsdoc/require-property-name": 'warn',
"jsdoc/require-property-type": 'warn',
"jsdoc/require-returns-check": 'warn',
"jsdoc/require-returns-description": 'warn',
"jsdoc/require-returns-type": 'warn',
"jsdoc/require-yields-check": 'warn',
"jsdoc/valid-types": 'warn',
"jsdoc/require-jsdoc": ['warn', {
'jsdoc/check-access': 'warn',
'jsdoc/check-alignment': 'warn',
'jsdoc/check-param-names': 'warn',
'jsdoc/check-property-names': 'warn',
'jsdoc/check-tag-names': ['warn', { definedTags: ['category'] }],
'jsdoc/check-types': 'warn',
'jsdoc/empty-tags': 'warn',
'jsdoc/implements-on-classes': 'warn',
'jsdoc/multiline-blocks': 'warn',
'jsdoc/tag-lines': 'warn',
'jsdoc/no-multi-asterisks': 'warn',
'jsdoc/require-param-description': 'warn',
'jsdoc/require-param-name': 'warn',
'jsdoc/require-param-type': 'warn',
'jsdoc/require-property-description': 'warn',
'jsdoc/require-property-name': 'warn',
'jsdoc/require-property-type': 'warn',
'jsdoc/require-returns-check': 'warn',
'jsdoc/require-returns-description': 'warn',
'jsdoc/require-returns-type': 'warn',
'jsdoc/require-yields-check': 'warn',
'jsdoc/valid-types': 'warn',
'jsdoc/require-jsdoc': ['warn', {
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
Expand All @@ -117,4 +128,4 @@ module.exports = {
}
},
],
};
}
Loading