Skip to content

Commit

Permalink
refactor(eslint): use standard filenames
Browse files Browse the repository at this point in the history
The old filenames are not standard to ESLint and causes some problems for editor plugins. By naming
the config files to the default .eslintrc.js it will make it easier to use those kinds of plugins.
Also, by moving the the config file used for the src directory into the src directory, we can also
get away with running the linter just once instead of both for src and config.
  • Loading branch information
jgroth authored and jensgustafsson committed Aug 11, 2020
1 parent 302056b commit 9668ab2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.docz/
.github/
.vscode/
dist/
node_modules/
www/
1 change: 1 addition & 0 deletions .eslintrc.config.js → .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.lint.json',
},
plugins: [
'@typescript-eslint',
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
"watch:prod": "shx rm -rf .docz/ && cross-env-shell SASS_PATH=node_modules \"stencil build --watch --docs\"",
"docz:build": "npm run dev && docz build && cross-env-shell NODE_ENV=prod SASS_PATH=node_modules \"stencil build --docs --config stencil.config.docs.ts\"",
"docz:publish": "node publish-docs.js",
"lint": "npm run lint:src && npm run lint:scss && npm run lint:config",
"lint:fix": "npm run lint:src:fix && npm run lint:scss:fix && npm run lint:config:fix",
"lint:config": "eslint --config .eslintrc.config.js './*.{ts,js}' --max-warnings=0 && prettier -l '{!(package*).json,.prettierrc}'",
"lint:config:fix": "eslint --config .eslintrc.config.js './*.{ts,js}' --fix --max-warnings=0 && prettier --write '{!(package*).json,.prettierrc}'",
"lint:src": "eslint --config .eslintrc.src.js './src/**/*.{ts,tsx}' --max-warnings=0",
"lint:src:fix": "eslint --config .eslintrc.src.js './src/**/*.{ts,tsx}' --fix --max-warnings=0",
"lint": "npm run lint:src && npm run lint:scss",
"lint:fix": "npm run lint:src:fix && npm run lint:scss:fix",
"lint:src": "eslint '**/*.{ts,tsx,js}' --max-warnings=0",
"lint:src:fix": "eslint '**/*.{ts,tsx,js}' --fix --max-warnings=0",
"lint:scss": "prettier -c --ignore-path ./.gitignore **/*.scss",
"lint:scss:fix": "prettier --write --ignore-path ./.gitignore **/*.scss",
"release": "npm run build && semantic-release",
Expand Down
12 changes: 7 additions & 5 deletions .eslintrc.src.js → src/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-env node */
module.exports = {
root: true,
env: {
browser: true,
es2020: true,
Expand All @@ -19,7 +20,7 @@ module.exports = {
},
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.lint.json',
project: 'tsconfig.lint.json',
},
plugins: [
'@typescript-eslint',
Expand Down Expand Up @@ -132,10 +133,11 @@ module.exports = {
overrides: [
{
files: [
'src/components/**/examples/**',
'src/**/*.spec.{ts,tsx}',
'src/**/*.e2e.{ts,tsx}',
'src/**/*.test-wrapper.{ts,tsx}',
'./components/**/examples/**',
'./**/*.spec.{ts,tsx}',
'./**/*.e2e.{ts,tsx}',
'./**/*.test-wrapper.{ts,tsx}',
'.eslintrc.js',
],
rules: {
'@stencil/required-jsdoc': 'off',
Expand Down
7 changes: 4 additions & 3 deletions tsconfig.lint.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
},
"resolveJsonModule": true,
"skipLibCheck": true,
"typeRoots": ["types", "node_modules/@types"]
"typeRoots": ["types", "node_modules/@types"],
"allowJs": true
},
"include": ["src", "types/jsx.d.ts"],
"exclude": ["node_modules", "**/dev-assets/**"]
"include": [".", ".eslintrc.js", "src/.eslintrc.js"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion types/tabulator-tables/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
declare module "tabulator-tables" {
declare module 'tabulator-tables' {
export default Tabulator;
}

0 comments on commit 9668ab2

Please sign in to comment.