Skip to content

Commit

Permalink
Update eslint from v6 to v7. Update typescript from v3 to v4. Fix cod…
Browse files Browse the repository at this point in the history
…e cause of updating recomendations (fullExtends in eslintrc).
  • Loading branch information
viT-1 committed Apr 30, 2021
1 parent d74cef2 commit e90f5a2
Show file tree
Hide file tree
Showing 15 changed files with 1,344 additions and 634 deletions.
22 changes: 14 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const baseExtends = [

const fullExtends = [
'eslint:recommended',
'plugin:markdown/recommended',
'plugin:@typescript-eslint/recommended',
'airbnb-typescript/base',
'./common.eslintrc.js',
Expand All @@ -14,7 +15,13 @@ const conf = {
env: {
es6: true,
},
// ignorePatterns: ['**/tsconfig.*.json'],
parser: '@typescript-eslint/parser',
parserOptions: {
createDefaultProgram: true,
extraFileExtensions: ['.json', '.md'],
project: 'tsconfig.lint.json',
},
plugins: [
'@typescript-eslint',
'import',
Expand All @@ -28,10 +35,16 @@ const conf = {
'import/parsers': { '@typescript-eslint/parser': ['.ts'] },
'import/resolver': {
'node': { 'extensions': ['.js', '.ts'] },
'typescript': { 'directory': './src' },
'typescript': { 'project': './src' },
},
},
overrides: [
{
// Enable the Markdown processor for all .md files.
// Still doesn't work https://github.com/eslint/eslint-plugin-markdown/issues/114#issuecomment-620970670
files: ['**/*.md'],
processor:'markdown/markdown'
},
{
files: ['**/*.json', '*.json'],
extends: [...fullExtends, 'plugin:json/recommended-with-comments'],
Expand Down Expand Up @@ -90,13 +103,6 @@ const conf = {
],
},
],
// preparing for eslint-config-airbnb-typescript v7:
// https://github.com/iamturns/eslint-config-airbnb-typescript/pull/63
// parserOptions: {
// project: './src/tsconfig.lint.json',
// extraFileExtensions: ['.json'],
// createDefaultProgram: true
// },
};

module.exports = conf;
29 changes: 19 additions & 10 deletions common.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const conf = {
rules: {
// 'curly': ['error', 'all', 'consistent'],
'comma-dangle': ['error', 'always-multiline'],
'import/no-extraneous-dependencies': [
'error', {
'devDependencies': [
Expand All @@ -18,19 +19,27 @@ const conf = {
'no-console': 'off',
'no-trailing-spaces': 'error',
'no-tabs': ['warn', { 'allowIndentationTabs': true }],
'quotes': ['error', 'single'],
'@typescript-eslint/ban-types': ['error', {
'types': { 'Function': false },
'extendDefaults': true
}],
'@typescript-eslint/brace-style': ['error', 'stroustrup'],
'@typescript-eslint/indent': [
'error',
'tab', // airbnb set 2 spaces
{
SwitchCase: 1, // Only this from airbnb redefines default
// Other Airbnb setting same as default, JSX no matter
},
],
'@typescript-eslint/indent': ['error', 'tab', {
SwitchCase: 1, // Only this from airbnb redefines default
// Other Airbnb setting same as default, JSX no matter
}],
'@typescript-eslint/no-unused-vars': ['warn'],
// Old school interface class naming
'@typescript-eslint/interface-name-prefix': ['error', 'always'],
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/naming-convention': ['error', {
'selector': 'interface',
'format': ['PascalCase'],
'custom': {
'regex': '^I[A-Z]',
'match': true
}
}],
'@typescript-eslint/ban-ts-comment': 'off',
},
};

Expand Down
4 changes: 2 additions & 2 deletions gulpfile.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ task('copyEsmAssets',
const vueClass = src([
path.resolve('node_modules', 'vue-class-component', 'dist', 'vue-class-component.esm.js'),
])
.pipe(gReplace('process.env.NODE_ENV', "JSON.stringify('production')"))
.pipe(gReplace('process.env.NODE_ENV', 'JSON.stringify(\'production\')'))
.pipe(dest(absDest));

// TODO: only if not exists on dest folder
const vueProp = src([
path.resolve('node_modules', 'vue-property-decorator', 'lib', 'vue-property-decorator.js'),
])
.pipe(gReplace("/// <reference types='reflect-metadata'/>", ""))
.pipe(gReplace('/// <reference types=\'reflect-metadata\'/>', ''))
.pipe(gRename({ extname: '.esm.js' }))
.pipe(dest(absDest));

Expand Down
Loading

0 comments on commit e90f5a2

Please sign in to comment.