Skip to content
Open
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
170 changes: 86 additions & 84 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,86 @@
module.exports = {
extends: ['eslint:recommended', 'airbnb-base'],
env: {
browser: true,
node: true,
jest: true,
es6: true,
},
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module',
},
rules: {
'import/prefer-default-export': 0,
'import/extensions': 0,
'max-classes-per-file': 0,
complexity: [0, 11],
'no-prototype-builtins': 0,
'prefer-destructuring': 0,
'no-restricted-globals': 0,
'consistent-return': 2,
curly: [2, 'multi-line'],
'default-case': 2,
'dot-location': 0,
'dot-notation': [2, { allowKeywords: true }],
eqeqeq: 1,
'guard-for-in': 1,
'no-alert': 1,
'no-caller': 1,
'no-case-declarations': 2,
'no-div-regex': 0,
'no-else-return': 2,
'no-empty-pattern': 0,
'no-eq-null': 0,
'no-eval': 2,
'no-extend-native': 2,
'no-extra-bind': 1,
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-implicit-coercion': 0,
'no-implied-eval': 2,
'no-invalid-this': 0,
'no-iterator': 2,
'no-labels': [2, { allowLoop: true, allowSwitch: true }],
'no-lone-blocks': 2,
'no-loop-func': 1,
'no-magic-numbers': 0,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-native-reassign': 2,
'no-new-func': 2,
'no-new-wrappers': 2,
'no-new': 0,
'no-octal-escape': 2,
'no-octal': 2,
'no-console': 0,
'no-param-reassign': [2, { props: true }],
'no-process-env': 0,
'no-proto': 0,
'no-redeclare': 2,
'no-return-assign': 2,
'no-script-url': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-throw-literal': 2,
'no-unused-expressions': 2,
'no-useless-call': 0,
'no-useless-concat': 0,
'no-void': 0,
'no-warning-comments': [0, { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
'no-with': 2,
radix: 2,
'vars-on-top': 0,
'wrap-iife': [2, 'outside'],
yoda: 2,
},
settings: {
'import/resolver': {
node: {
paths: ['./'],
},
},
},
};
module.exports = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

а ты вносил какие-то правки в файл?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

в линтер залазил. чтобы делал одинарные кавычки, чтобы делал автокоррекцию после сохранения сразу. больше вроде ничего.

extends: ['eslint:recommended', 'airbnb-base'],
env: {
browser: true,
node: true,
jest: true,
es6: true,
},
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module',
},
rules: {
'import/prefer-default-export': 0,
'import/extensions': 0,
'max-classes-per-file': 0,
complexity: [0, 11],
'no-prototype-builtins': 0,
'prefer-destructuring': 0,
'no-restricted-globals': 0,
'consistent-return': 2,
curly: [2, 'multi-line'],
'default-case': 2,
'dot-location': 0,
'dot-notation': [2, { allowKeywords: true }],
eqeqeq: 1,
'guard-for-in': 1,
'no-alert': 1,
'no-caller': 1,
'no-case-declarations': 2,
'no-div-regex': 0,
'no-else-return': 2,
'no-empty-pattern': 0,
'no-eq-null': 0,
'no-eval': 2,
'no-extend-native': 2,
'no-extra-bind': 1,
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-implicit-coercion': 0,
'no-implied-eval': 2,
'no-invalid-this': 0,
'no-iterator': 2,
'no-labels': [2, { allowLoop: true, allowSwitch: true }],
'no-lone-blocks': 2,
'no-loop-func': 1,
'no-magic-numbers': 0,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-native-reassign': 2,
'no-new-func': 2,
'no-new-wrappers': 2,
'no-new': 0,
'no-octal-escape': 2,
'no-octal': 2,
'no-console': 0,
'no-param-reassign': [2, { props: true }],
'no-process-env': 0,
'no-proto': 0,
'no-redeclare': 2,
'no-return-assign': 2,
'no-script-url': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-throw-literal': 2,
'no-unused-expressions': 2,
'no-useless-call': 0,
'no-useless-concat': 0,
'no-void': 0,
'no-warning-comments': [0, { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
'no-with': 2,
'no-plusplus' : 0,
'no-bitwise' : 0,
radix: 2,
'vars-on-top': 0,
'wrap-iife': [2, 'outside'],
yoda: 2,
},
settings: {
'import/resolver': {
node: {
paths: ['./'],
},
},
},
};
11 changes: 11 additions & 0 deletions src/ex3_js-objects-part1/task-01.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const person = {
name: 'Den',
surname: 'Steshin',
age: 26,
birthdate: '26.11.1995',
student: true,
skills: { html: 'expert', css: 'expert', javascript: 'expert' },
resident: ['Russian Federation', 'Ryazan'],
};

delete person.age;
7 changes: 7 additions & 0 deletions src/ex3_js-objects-part1/task-02.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function showValues(object) {
for (const key in object) {
console.log(key, object[key]);
}
}

module.exports = showValues();
10 changes: 10 additions & 0 deletions src/ex3_js-objects-part1/task-03.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function checkPropertyInObject(property, object) {
for (const key in object) {
if (property === key && object.hasOwnProperty(key)) {
return true;
}
}
return false;
}

module.exports = checkPropertyInObject;
13 changes: 13 additions & 0 deletions src/ex3_js-objects-part1/task-04.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function addValueInObject(string, object) {
for (const key in object) {
if (string === key && object.hasOwnProperty(key)) {
return true;
}
}

object[string] = 'new';

return object;
}

module.exports = addValueInObject;
5 changes: 5 additions & 0 deletions src/ex3_js-objects-part1/task-05.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function cloneObject(object) {
return { ...object };
}

module.exports = cloneObject;
12 changes: 12 additions & 0 deletions src/ex3_js-objects-part1/task-06.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function getProperty(object, propertyPath) {
let currentObject = object;

for (const property of propertyPath.split('.')) {
if (currentObject == null) return undefined;
currentObject = currentObject[property];
}

return currentObject;
}

module.exports = getProperty;
19 changes: 19 additions & 0 deletions src/ex3_js-objects-part1/task-07.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function deepCloneObject(object) {
const copyDeepObject = {};
for (const key in object) {
if (
typeof object[key] === 'object'
&& object[key] !== null
&& !(object[key] instanceof Array)
) {
copyDeepObject[key] = deepCloneObject(object[key]);
} else if (object[key] instanceof Array) {
copyDeepObject[key] = object[key].slice(0);
} else {
copyDeepObject[key] = object[key];
}
}
return copyDeepObject;
}

module.exports = deepCloneObject;
Empty file.