Skip to content

Commit

Permalink
chore: add eslint rule for console-log and debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
LwveMike committed Jan 22, 2024
1 parent b06cb86 commit 0df3f61
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 45 deletions.
5 changes: 0 additions & 5 deletions packages/playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ export default defineComponent({
}
},
methods: {
// eslint-disable-next-line
// @ts-ignore
containerResized (e) {
console.log(e)
},
foo () {
const groupWidgetByHeightInAxis = this.groupWidgetByHeightInAxis(this.layout)
const yAxis = Object.keys(groupWidgetByHeightInAxis)
Expand Down
2 changes: 0 additions & 2 deletions packages/vue-draggable-grid/src/components/GridItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ const createStyle = (): void => {
pos.height = resizing?.value?.height ?? 0
}
console.log(props.id)
style.props = props.useCssTransforms
? setTransform(pos.top, pos.left, pos.width, pos.height)
: setTopLeft(pos.top, pos.left, pos.width, pos.height)
Expand Down
1 change: 0 additions & 1 deletion packages/vue-draggable-grid/src/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export const moveElementAwayFromCollision = (layout: Layout, collidesWith: Layou
}

export const setTopLeft: setPositionFnc<CSSProperties> = (top, left, width, height) => {
console.log(top, left, width, height)
return {
height: `${height}px`,
left: `${left}px`,
Expand Down
74 changes: 37 additions & 37 deletions rules/eslint-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,65 @@ module.exports = {
'array-bracket-spacing': ['error', 'never'],
// allows omitting parens when there is only one argument
'arrow-parens': ['error', 'as-needed'],
// "promise/always-return": "error",
// requires space before/after arrow function's arrow.
'arrow-spacing': 'error',
'block-spacing': 'error',
// put brace after statement with 1 space and allow one inline statement
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
// looks for any underscores (_) located within the source code.
camelcase: 0,
// disallow trailing commas
'comma-dangle': ['error', 'never'],
// required to use type comparison === or !==
eqeqeq: ['error', 'always'], // ?
// enforces spacing around commas.
'comma-spacing': ['error', { after: true, before: false }],
// enforce consistent comma style in <template>
'comma-style': ['error', 'last'],
// Enforces newline before dots.
'dot-location': ['error', 'property'],
// enforces dot notation whenever possible.
'dot-notation': 'error',
// requires destructuring from arrays and/or objects
eqeqeq: ['error', 'always'],
// requires or disallows a space before function parenthesis.
indent: ['error', 2, { SwitchCase: 1 }],
'keyword-spacing': ['error', { after: true, before: true }], // ?
// required 2 indented spaces
indent: ['error', 2, { SwitchCase: 1 }], // ?
'newline-after-var': 'error', // ?
// enforce consistent spacing after keywords
'keyword-spacing': ['error', { after: true, before: true }],
'no-async-promise-executor': 'error',
// require an empty line after variable declarations
'newline-after-var': 'error',
'no-console': 'error',
// isn't allowed to use async Promises
'no-async-promise-executor': 'error', // ?
'no-debugger': 'error', // ?
// allow only console.error or console.warn
'no-console': process.env.NODE_ENV === 'production' ? ['error', { allow: ['warn', 'error'] }] : 'off',
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-trailing-spaces': 'error',
// amount of empty lines has been exceeded
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'no-unneeded-ternary': 'error',
// required not to have trailing spaces
'no-trailing-spaces': 'error',
'no-var': 'error',
// disallow ternary operators when simpler alternatives exist
'no-unneeded-ternary': 'error',
'object-curly-spacing': ['error', 'always'],
// require `let` or `const` instead of `var`
'no-var': 'error',
'object-shorthand': 'error',
// allow spaces between curly braces
'object-curly-spacing': ['error', 'always'],
'prefer-const': 'error',
// require object literal shorthand syntax
'object-shorthand': 'error',
'prefer-destructuring': 'error',
// Suggest using const
'prefer-const': 'error',
// Suggest using template literals instead of string concatenation
'prefer-template': 'error',
// require quotes around object literal property names
// Suggest using template literals instead of string concatenation
'quote-props': ['error', 'as-needed'],
// enforce the consistent use of either backticks, double, or single quotes
// require quotes around object literal property names
quotes: ['error', 'single'],
// enforce the consistent use of either backticks, double, or single quotes
semi: ['error', 'never'],
// disallow semicolons
semi: ['error', 'never'], // ?
'sort-exports/sort-exports': 'error', // ?
// sorted list of export declarations
'sort-exports/sort-exports': 'error',
// sorted list of import declarations
'sort-imports': [
'error',
{
Expand All @@ -59,24 +73,10 @@ module.exports = {
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple']
}
],
// disallow Space Before Blocks
// sorted list of import declarations
'space-before-blocks': 'error',
// "promise/always-return": "error",
// requires space before/after arrow function's arrow.
'arrow-spacing': 'error',
// enforces the spaces inside of blocks after opening blocks and before closing blocks.
'block-spacing': 'error',
// enforces spacing around commas.
'comma-spacing': ['error', { after: true, before: false }],
// enforce consistent comma style in <template>
'comma-style': ['error', 'last'],
// Enforces newline before dots.
'dot-location': ['error', 'property'],
// enforces dot notation whenever possible.
'dot-notation': 'error',
// requires destructuring from arrays and/or objects
'prefer-destructuring': 'error',
// requires or disallows a space before function parenthesis.
// disallow Space Before Blocks
'space-before-function-paren': 'error'
// enforces the spaces inside of blocks after opening blocks and before closing blocks.
}
}

0 comments on commit 0df3f61

Please sign in to comment.