Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Soontao committed Aug 10, 2020
1 parent 242c486 commit 789e972
Show file tree
Hide file tree
Showing 17 changed files with 211 additions and 160 deletions.
5 changes: 4 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.js
*.js
node_modules
lib
coverage
178 changes: 178 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/eslint-recommended"
],
"env": {
"es6": true,
"node": true,
"jest": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true,
"objectLiteralDuplicateProperties": false
}
},
"rules": {
"array-bracket-spacing": [
"error",
"never"
],
"camelcase": [
"error",
{
"properties": "never"
}
],
"comma-dangle": [
"error",
"never"
],
"curly": [
"error",
"all"
],
"eol-last": [
"error"
],
"indent": [
"error",
2,
{
"SwitchCase": 1
}
],
"no-tabs": "error",
"keyword-spacing": [
"error"
],
"no-else-return": [
"error"
],
"no-mixed-spaces-and-tabs": [
"error"
],
"no-multiple-empty-lines": [
"error"
],
"no-spaced-func": [
"error"
],
"no-trailing-spaces": [
"error"
],
"no-undef": [
"error"
],
"no-unexpected-multiline": [
"error"
],
"quotes": [
"error",
"single",
{
"allowTemplateLiterals": true,
"avoidEscape": true
}
],
"max-len": [
0
],
"semi": [
"error"
],
"space-before-blocks": [
"error",
"always"
],
"space-before-function-paren": [
"error",
"never"
],
"space-in-parens": [
"error",
"never"
],
"space-unary-ops": [
"error",
{
"nonwords": false,
"overrides": {}
}
],
// "valid-jsdoc": ["error"]
// ECMAScript 6 rules
"arrow-body-style": [
"error",
"as-needed",
{
"requireReturnForObjectLiteral": false
}
],
"arrow-parens": [
"error",
"always"
],
"arrow-spacing": [
"error",
{
"after": true,
"before": true
}
],
"no-class-assign": [
"error"
],
"no-const-assign": [
"error"
],
"no-duplicate-imports": [
"error"
],
"no-new-symbol": [
"error"
],
"no-useless-rename": [
"error"
],
"no-var": [
"error"
],
"object-shorthand": [
"error",
"always",
{
"avoidQuotes": true,
"ignoreConstructors": false
}
],
"prefer-arrow-callback": [
"error",
{
"allowNamedFunctions": false,
"allowUnboundThis": true
}
],
"prefer-const": [
"error"
],
"prefer-rest-params": [
"error"
],
"prefer-template": [
"error"
],
"template-curly-spacing": [
"error",
"never"
]
}
}
128 changes: 0 additions & 128 deletions .eslintrc.js

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": true,
"source.organizeImports": true
},
"jest.autoEnable": false
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"scripts": {
"prebuild": "npm run lint",
"build": "tsc",
"lint": "eslint src/**/*.ts --fix",
"lint": "eslint src/** --fix",
"coverage": "npm test -- --coverage --no-cache",
"typedoc": "typedoc --name \"OData v4 Filter Parser\" --excludeExternals --excludeNotExported --hideGenerator --excludeExternals --excludePrivate --out docs src",
"test": "jest",
Expand Down
4 changes: 2 additions & 2 deletions src/builder/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createRequireFromPath } from 'module';

export * from './batch';
export * from './filter';
export * from './param';
export * from './types';
export * from './batch';

5 changes: 2 additions & 3 deletions src/builder/param.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ODataFilter } from './filter';

import concat from '@newdash/newdash/concat';
import join from '@newdash/newdash/join';
import isArray from '@newdash/newdash/isArray';
import join from '@newdash/newdash/join';
import uniq from '@newdash/newdash/uniq';
import { ODataFilter } from './filter';

class SearchParams {

Expand Down
6 changes: 3 additions & 3 deletions src/expressions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Utils, { SourceArray } from './utils';
import * as ArrayOrObject from './json';
import * as Lexer from './lexer';
import * as NameOrIdentifier from './nameOrIdentifier';
import * as PrimitiveLiteral from './primitiveLiteral';
import Utils, { SourceArray } from './utils';

import * as NameOrIdentifier from './nameOrIdentifier';
import * as ArrayOrObject from './json';

export function commonExpr(value: SourceArray, index: number): Lexer.Token {
const token = PrimitiveLiteral.primitiveLiteral(value, index) ||
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Parser } from './parser';

export * from './parser';
export * from './builder';
export * from './lexer';
export * from './parser';
export * from './visitor';
export * from './builder';

export const defaultParser = new Parser();
7 changes: 3 additions & 4 deletions src/json.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import Utils, { SourceArray } from './utils';
import * as Expressions from './expressions';
import * as Lexer from './lexer';
import * as PrimitiveLiteral from './primitiveLiteral';

import * as NameOrIdentifier from './nameOrIdentifier';
import * as PrimitiveLiteral from './primitiveLiteral';
import Utils, { SourceArray } from './utils';

import * as Expressions from './expressions';

export function complexColInUri(value: SourceArray, index: number): Lexer.Token {
const begin = Lexer.beginArray(value, index);
Expand Down
Loading

0 comments on commit 789e972

Please sign in to comment.