Skip to content

Commit

Permalink
feat(tools): add eslint shareable config (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 committed Mar 16, 2021
1 parent 4c5d908 commit 843827e
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 95 deletions.
96 changes: 1 addition & 95 deletions .eslintrc.js
Expand Up @@ -5,41 +5,16 @@ module.exports = {
files: [
'*.ts'
],
plugins: [
'modules-newline',
'jasmine'
],
parserOptions: {
project: [
'tsconfig.json',
],
createDefaultProgram: true
},
extends: [
'plugin:@angular-eslint/ng-cli-compat',
'plugin:@angular-eslint/ng-cli-compat--formatting-add-on',
'plugin:@angular-eslint/template/process-inline-templates',
'plugin:import/typescript',
'plugin:jasmine/recommended',
'./tools/eslint/config/index.js',
],
rules: {
'prefer-arrow/prefer-arrow-functions': [
'error',
{
allowStandaloneDeclarations: true
}
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'enumMember',
format: ['PascalCase', 'UPPER_CASE', 'camelCase']
}
],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/member-ordering': 'off',
'import/no-unassigned-import': ['error'],
'import/order': [
'error',
{
Expand All @@ -61,75 +36,6 @@ module.exports = {
}
}
],
'modules-newline/import-declaration-newline': 'warn',
'modules-newline/export-declaration-newline': 'warn',
indent: [
'error',
2,
{
SwitchCase: 1
}
],
'object-curly-newline': [
'error',
{
ImportDeclaration: {multiline: true, minProperties: 2},
ExportDeclaration: {multiline: true, minProperties: 2}
}
],
'object-curly-spacing': [
'error',
'always',
{
arraysInObjects: false,
objectsInObjects: false
}
],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{
functions: false
}
],
'@angular-eslint/component-class-suffix': [
'error',
{
suffixes: [
'Component'
]
}
],
'@typescript-eslint/consistent-type-assertions': [
'error',
{
assertionStyle: 'angle-bracket'
}
],
'@typescript-eslint/consistent-type-definitions': [ 'error', 'interface'],
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'off',
{
accessibility: 'explicit'
}
],
'brace-style': [
'error',
'1tbs'
],
'no-trailing-spaces': 'error',
'comma-dangle': [
'error',
'always-multiline'
],
'id-blacklist': 'off',
'id-match': 'off',
'no-underscore-dangle': 'off',
'max-len': 'off',
'jasmine/no-suite-dupes': ['warn', 'branch'],
'jasmine/no-spec-dupes': ['warn', 'branch'],
'jasmine/new-line-before-expect': 'off',
}
},
{
Expand Down
101 changes: 101 additions & 0 deletions tools/eslint/config/index.js
@@ -0,0 +1,101 @@
module.exports = {
plugins: [
'modules-newline',
'jasmine'
],
extends: [
'plugin:@angular-eslint/ng-cli-compat',
'plugin:@angular-eslint/ng-cli-compat--formatting-add-on',
'plugin:@angular-eslint/template/process-inline-templates',
'plugin:import/typescript',
'plugin:jasmine/recommended',
],
rules: {
'prefer-arrow/prefer-arrow-functions': [
'error',
{
allowStandaloneDeclarations: true
}
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'enumMember',
format: ['PascalCase', 'UPPER_CASE', 'camelCase']
}
],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/member-ordering': 'off',
'import/no-unassigned-import': ['error'],
'modules-newline/import-declaration-newline': 'warn',
'modules-newline/export-declaration-newline': 'warn',
indent: [
'error',
2,
{
SwitchCase: 1
}
],
'object-curly-newline': [
'error',
{
ImportDeclaration: {multiline: true, minProperties: 2},
ExportDeclaration: {multiline: true, minProperties: 2}
}
],
'object-curly-spacing': [
'error',
'always',
{
arraysInObjects: false,
objectsInObjects: false
}
],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{
functions: false
}
],
'@angular-eslint/component-class-suffix': [
'error',
{
suffixes: [
'Component'
]
}
],
'@typescript-eslint/consistent-type-assertions': [
'error',
{
assertionStyle: 'angle-bracket'
}
],
'@typescript-eslint/consistent-type-definitions': [ 'error', 'interface'],
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'off',
{
accessibility: 'explicit'
}
],
'brace-style': [
'error',
'1tbs'
],
'no-trailing-spaces': 'error',
'comma-dangle': [
'error',
'always-multiline'
],
'id-blacklist': 'off',
'id-match': 'off',
'no-underscore-dangle': 'off',
'max-len': 'off',
'jasmine/no-suite-dupes': ['warn', 'branch'],
'jasmine/no-spec-dupes': ['warn', 'branch'],
'jasmine/new-line-before-expect': 'off',
}
}
31 changes: 31 additions & 0 deletions tools/eslint/config/package.json
@@ -0,0 +1,31 @@
{
"name": "@daffodil/eslint-config",
"version": "0.0.1",
"description": "Eslint shareable config for Angular projects using the Daffodil team's in-house style.",
"main": "./index.js",
"peerDependencies": {
"@angular-eslint/eslint-plugin": "1.1.0",
"@angular-eslint/template-parser": "1.1.0",
"@typescript-eslint/eslint-plugin": "4.3.0",
"@typescript-eslint/parser": "4.3.0",
"eslint": "^7.6.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jasmine": "^4.1.2",
"eslint-plugin-jsdoc": "^30.7.6",
"eslint-plugin-modules-newline": "^0.0.6",
"eslint-plugin-prefer-arrow": "^1.2.2"
},
"keywords": [
"code checker",
"code linter",
"code standards",
"code style",
"eslint",
"eslintconfig",
"hint",
"lint",
"style",
"style checker",
"style linter"
]
}

0 comments on commit 843827e

Please sign in to comment.