Skip to content

Commit

Permalink
Merge pull request #1 from Exabyte-io/feat/SOF-6397
Browse files Browse the repository at this point in the history
SOF-6397: Create mat3ra eslint config and publish on npm
  • Loading branch information
timurbazhirov authored Nov 15, 2022
2 parents f4c0a2c + f868036 commit 93b971e
Show file tree
Hide file tree
Showing 8 changed files with 5,516 additions and 162 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["airbnb", "prettier", "eslint:recommended"],
"extends": ["airbnb", "eslint:recommended"],
"settings": {
"import/resolver": {
"node": {
Expand All @@ -14,9 +14,8 @@
"node": true,
"mocha": true
},
"plugins": ["prettier", "simple-import-sort", "jsdoc"],
"plugins": ["simple-import-sort", "jsdoc"],
"rules": {
"prettier/prettier": "error",
"comma-dangle": ["error", "always-multiline"],
"array-element-newline": ["error", "consistent"],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
Expand Down
44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
# template-definitions
[![npm version](https://badge.fury.io/js/%40exabyte-io%2Feslint-config-mat3ra.svg)](https://badge.fury.io/js/%40exabyte-io%2Feslint-config-mat3ra)
[![License: Apache](https://img.shields.io/badge/License-Apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)

Template repository for entity definition libraries in Javascript
# eslint-config-mat3ra

See [here](https://docs.github.com/en/github-ae@latest/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)
for details on how to use this repository.
## How to use

Included is a simple `template.py` analog to `cookiecutter` which will prompt
the user for some information and then write out templated values in select files.
After usage, the `template.py` file can be removed and the `README.md` and associated
`files` can be committed.
1. Install config with eslint and eslint plugins

```
npm install --save-dev \
@exabyte-io/[email protected] \
@babel/[email protected] \
@babel/[email protected] \
@babel/[email protected] \
@babel/[email protected] \
@babel/register@^7.16.0 \
@babel/[email protected] \
[email protected] \
[email protected] \
[email protected] \
eslint-import-resolver-exports@^1.0.0-beta.2 \
eslint-import-resolver-meteor@^0.4.0 \
eslint-import-resolver-node@^0.3.6 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]
```


2. Create own `.eslintrc.json`:

```
{
"extends": "mat3ra"
}
```
78 changes: 78 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
module.exports = {
extends: ['airbnb', 'eslint:recommended'],
settings: {
'import/resolver': {
node: {
paths: ['src'],
},
exports: {},
},
},
parser: '@babel/eslint-parser',
env: {
browser: true,
node: true,
mocha: true,
},
plugins: ['simple-import-sort', 'jsdoc'],
rules: {
'array-element-newline': ['error', 'consistent'],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'one-var': ['error', { uninitialized: 'always', initialized: 'never' }],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'prefer-template': 'off',
camelcase: 'off',
'no-console': 'off',
'no-unused-expressions': 'warn',
'no-confusing-arrow': 'off',
'no-underscore-dangle': 'off',
'no-return-assign': 'off',
'consistent-return': 'off',
'arrow-body-style': 'off',
'import/prefer-default-export': 'off',
'import/no-named-as-default-member': 'warn',
'no-param-reassign': ['warn', { props: false }],
'max-classes-per-file': 'warn',
'simple-import-sort/imports': [
'warn',
{
groups: [
// Side effect imports.
['^\\u0000'],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
// Absolute imports
[
'^(components|configs|constants|containers|domain|enhancers|hocs|libs|pages|reducers|services|store|modules|dictionaries)(/.*|$)',
],
// Relative imports.
// Anything that starts with a dot.
['^\\.'],
],
},
],
indent: [
'error',
4,
{
SwitchCase: 1,
ignoredNodes: ['TemplateLiteral'],
},
],
'comma-dangle': ['error', 'always-multiline'],
quotes: [1, 'double', 'avoid-escape'],
'jsx-quotes': ['error', 'prefer-double'],
'max-len': [
'error',
100,
4,
{
ignoreUrls: true,
ignoreComments: true,
ignoreTemplateLiterals: true,
ignoreStrings: true,
},
],
},
};
Loading

0 comments on commit 93b971e

Please sign in to comment.