Skip to content

Commit

Permalink
Merge pull request #3 from Exabyte-io/feat/SOF-6397-1
Browse files Browse the repository at this point in the history
SOF-6397-1: add prettier plugin and config for eslint
  • Loading branch information
unsigned6 authored Nov 17, 2022
2 parents a07ab62 + 8aac0d3 commit 6803b25
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 107 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["airbnb", "eslint:recommended"],
"extends": ["airbnb", "prettier", "eslint:recommended"],
"settings": {
"import/resolver": {
"node": {
Expand All @@ -14,8 +14,9 @@
"node": true,
"mocha": true
},
"plugins": ["simple-import-sort", "jsdoc"],
"plugins": ["prettier", "simple-import-sort", "jsdoc"],
"rules": {
"prettier/prettier": "error",
"comma-dangle": ["error", "always-multiline"],
"object-curly-spacing": "error",
"no-trailing-spaces": "error",
Expand Down
63 changes: 38 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,45 @@

1. Install config with eslint and eslint plugins

```
npm install --save-dev \
@exabyte-io/eslint-config \
@babel/[email protected] \
@babel/[email protected] \
@babel/[email protected] \
@babel/[email protected] \
@babel/register@^7.16.0 \
@babel/[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]
```
```
npm install --save-dev \
@exabyte-io/eslint-config \
@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": "@exabyte-io/eslint-config"
}
```
```JSON
{
"extends": "@exabyte-io/eslint-config"
}
```

3. Add prettier config `.prettierrc`:

```JSON
{
"singleQuote": false,
"printWidth": 100,
"trailingComma": "all",
"tabWidth": 4
}
```
131 changes: 55 additions & 76 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,59 @@
module.exports = {
extends: ['airbnb', 'eslint:recommended'],
settings: {
'import/resolver': {
node: {
paths: ['src'],
},
exports: {},
extends: ["airbnb", "prettier", "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 }],
'object-curly-spacing': 'error',
'no-trailing-spaces': 'error',
'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.
['^\\.'],
parser: "@babel/eslint-parser",
env: {
browser: true,
node: true,
mocha: true,
},
plugins: ["simple-import-sort", "prettier", "jsdoc"],
rules: {
"prettier/prettier": "error",
"array-element-newline": ["error", "consistent"],
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
"object-curly-spacing": "error",
"no-trailing-spaces": "error",
"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,
},
],
},
},
};
32 changes: 31 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
"main": "index.js",
"files": [
"index.js",
".babelrc"
".babelrc",
".prettierrc"
],
"author": "Exabyte Inc.",
"bugs": {
"url": "https://github.com/Exabyte-io/eslint-config-mat3ra/issues"
"url": "https://github.com/Exabyte-io/eslint-config/issues"
},
"license": "Apache-2.0",
"homepage": "https://github.com/Exabyte-io/eslint-config-mat3ra",
"homepage": "https://github.com/Exabyte-io/eslint-config",
"devDependencies": {
"@babel/eslint-parser": "7.16.3",
"@babel/plugin-proposal-class-properties": "7.16.0",
Expand All @@ -33,12 +34,14 @@
"@babel/runtime-corejs3": "7.16.8",
"eslint": "7.32.0",
"eslint-config-airbnb": "19.0.2",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-exports": "^1.0.0-beta.2",
"eslint-import-resolver-meteor": "^0.4.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jsdoc": "37.1.0",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "7.30.0",
"eslint-plugin-simple-import-sort": "7.0.0",
"husky": "^7.0.4",
Expand All @@ -56,12 +59,14 @@
"@babel/runtime-corejs3": "7.16.8",
"eslint": "7.32.0",
"eslint-config-airbnb": "19.0.2",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-exports": "^1.0.0-beta.2",
"eslint-import-resolver-meteor": "^0.4.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jsdoc": "37.1.0",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "7.30.0",
"eslint-plugin-simple-import-sort": "7.0.0"
},
Expand Down

0 comments on commit 6803b25

Please sign in to comment.