-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch master of https://github.com/seznam/ima into cnsqa-1672
- Loading branch information
Showing
71 changed files
with
26,730 additions
and
21,437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx --no-install lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry = "https://registry.npmjs.org/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,247 @@ | ||
const babelParser = require('@babel/eslint-parser'); | ||
const js = require('@eslint/js'); | ||
const importPlugin = require('eslint-plugin-import'); | ||
const jest = require('eslint-plugin-jest'); | ||
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended'); | ||
const reactPlugin = require('eslint-plugin-react'); | ||
const globals = require('globals'); | ||
const typescriptEslint = require('typescript-eslint'); | ||
|
||
module.exports = typescriptEslint.config( | ||
{ | ||
ignores: [ | ||
'**/node_modules/**', | ||
'**/dist/**', | ||
'**/build/**', | ||
'**/docs/**', | ||
'**/.docusaurus/**', | ||
'**/coverage/**', | ||
'packages/create-ima-app/**/.eslintrc.js', | ||
'packages/create-ima-app/examples/todos/assets/**', | ||
], | ||
}, | ||
js.configs.recommended, | ||
reactPlugin.configs.flat.recommended, | ||
reactPlugin.configs.flat['jsx-runtime'], | ||
jest.configs['flat/recommended'], | ||
jest.configs['flat/style'], | ||
eslintPluginPrettierRecommended, | ||
importPlugin.flatConfigs.recommended, | ||
{ | ||
rules: { | ||
'no-console': [ | ||
'error', | ||
{ | ||
allow: ['warn', 'error'], | ||
}, | ||
], | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
destructuredArrayIgnorePattern: '^_', | ||
ignoreRestSiblings: true, | ||
caughtErrors: 'none', | ||
}, | ||
], | ||
|
||
// Prettier | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
singleQuote: true, | ||
semi: true, | ||
trailingComma: 'es5', | ||
jsxSingleQuote: true, | ||
bracketSameLine: false, | ||
arrowParens: 'avoid', | ||
}, | ||
], | ||
|
||
// Jest plugin overrides | ||
'jest/no-mocks-import': 'off', | ||
'jest/valid-title': 'off', | ||
'jest/no-done-callback': 'warn', | ||
'jest/no-disabled-tests': 'warn', | ||
'jest/no-conditional-expect': 'warn', | ||
'jest/prefer-expect-resolves': 'warn', | ||
'jest/prefer-lowercase-title': [ | ||
'warn', | ||
{ | ||
ignore: ['describe'], | ||
}, | ||
], | ||
|
||
// React plugin overrides | ||
'react/prop-types': 'off', | ||
'react/no-deprecated': 'off', | ||
|
||
// Import plugin | ||
'import/no-unresolved': [ | ||
'warn', | ||
{ | ||
ignore: [ | ||
'^@\\/', // ignore @/* aliases | ||
'@(docusaurus|theme)', | ||
], | ||
}, | ||
], | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: ['builtin', 'external', 'internal'], | ||
pathGroups: [ | ||
{ | ||
pattern: '{preact|react|svelte|docusaurus|theme}{/**,**}', | ||
group: 'external', | ||
position: 'before', | ||
}, | ||
{ | ||
pattern: '@/**', | ||
group: 'internal', | ||
position: 'after', | ||
}, | ||
{ | ||
pattern: '*.{css,less,json,html,txt,csv,png,jpg,svg}', | ||
group: 'object', | ||
patternOptions: { matchBase: true }, | ||
position: 'after', | ||
}, | ||
], | ||
'newlines-between': 'always', | ||
alphabetize: { | ||
order: 'asc', | ||
caseInsensitive: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.jsx', '.mjs', '.json'], | ||
}, | ||
typescript: { | ||
project: './packages/*/tsconfig.json', | ||
}, | ||
}, | ||
}, | ||
languageOptions: { | ||
parser: babelParser, | ||
parserOptions: { | ||
sourceType: 'module', | ||
requireConfigFile: false, | ||
babelOptions: { | ||
presets: ['@babel/preset-react'], | ||
}, | ||
}, | ||
globals: { | ||
...globals.browser, | ||
...globals.node, | ||
...globals.es2022, | ||
$Debug: true, | ||
$IMA: true, | ||
}, | ||
}, | ||
}, | ||
// Typescript support | ||
{ | ||
files: ['**/*.{ts,tsx}'], | ||
extends: [...typescriptEslint.configs.recommended], | ||
languageOptions: { | ||
...typescriptEslint.configs.recommended.languageOptions, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ['./tsconfig.json', './packages/*/tsconfig.json'], | ||
}, | ||
}, | ||
rules: { | ||
'import/named': 'off', // @FIXME: Doesn't work properly when importing types - https://github.com/import-js/eslint-plugin-import/issues/3048 | ||
'@typescript-eslint/ban-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/ban-ts-comment': [ | ||
'error', | ||
{ 'ts-expect-error': false }, | ||
], | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
destructuredArrayIgnorePattern: '^_', | ||
ignoreRestSiblings: true, | ||
args: 'none', | ||
caughtErrors: 'none', | ||
}, | ||
], | ||
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }], | ||
'@typescript-eslint/no-empty-object-type': [ | ||
'error', | ||
{ allowObjectTypes: 'always', allowInterfaces: 'always' }, | ||
], | ||
'@typescript-eslint/no-unused-expressions': 'off', | ||
'@typescript-eslint/no-require-imports': 'off', | ||
}, | ||
}, | ||
// Type-checkd Typescript support | ||
// TODO gradually enable everywhere | ||
{ | ||
files: ['packages/react-page-renderer/**/!(__tests__)/*.{ts,tsx}'], | ||
extends: [...typescriptEslint.configs.recommendedTypeChecked], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unused-expressions': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['packages/devtools/**'], | ||
rules: { | ||
// Don't work properly with aliases | ||
'import/named': 'off', | ||
'import/namespace': 'off', | ||
}, | ||
}, | ||
// Website/docs overrides | ||
{ | ||
files: ['website/**'], | ||
rules: { | ||
'react/react-in-jsx-scope': 'error', | ||
'react/jsx-uses-react': 'error', | ||
}, | ||
}, | ||
// Other overrides | ||
{ | ||
files: [ | ||
'website/scripts/**', | ||
'packages/cli/**', | ||
'packages/hmr-client/**', | ||
'packages/plugin-cli/**', | ||
'packages/dev-utils/**', | ||
'packages/create-ima-app/**', | ||
], | ||
rules: { | ||
'no-console': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['packages/devtools/**', 'packages/create-ima-app/**'], | ||
languageOptions: { | ||
globals: { | ||
chrome: true, | ||
FB: true, | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['packages/create-ima-app/template/**'], | ||
rules: { | ||
// Template is generated dynamically and some imports are not resolvable at the time of linting | ||
'import/no-unresolved': 'off', | ||
}, | ||
} | ||
); |
Oops, something went wrong.